智慧人居服务
更新时间:2018-12-20 18:15:28
a1. 概览
此文档了提供了智慧人居相关的服务接口
公共字段:以下参数通过登录信息中提取,不需要每次调用的时候传递
参数名称 | 参数 |
---|---|
用户ID | identityId |
租户ID | tenantId |
登录用户租户ID | identityTenantId |
appKey | appKey |
资源隔离ID | isolationId |
环境(开发,线上) | env |
调用方Ip | clientIp |
语言 | language |
地理位置、ip | locale |
2. 设备管理服务
2.1. 常用设备列表
2.1.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/homelink/device/frequency/list | 1.0.0 | 查询常用设备列表 | 是 |
2.1.2. 请求参数
参数名 | 类型 | 是否必须 | 说明 |
---|---|---|---|
houseId | String | 是 | 房屋ID |
pageNo | Integer | 是 | 页码,从1开始,默认1 |
pageSize | Integer | 是 | 每页数据条数.默认为20. |
2.1.3. 返回参数
参数名 | 类型 | 说明 |
---|---|---|
data | List | 设备列表 |
total | integer | 数据总数 |
2.1.4. 示例
- 请求实例
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.0",
"iotToken": "token"
},
"params": {
"houseId": "houseId1234",
"pageNo": 1,
"pageSize": 20
}
}
- 返回实例
{ "data": [ { "identityId": "5076al2344c628cf6dabb6137a7c3021cb3f4519", "iotId": "SwLa4NGAoEllg0TGzgAo0010bf1100", "productKey": "a1XHsQqSfck", "deviceName": "SwLa4NGAoEllg0TGzgAo", "productName": "测试", "categoryImage": "http://iotx-paas-admin.oss-cn-shanghai.aliyuncs.com/daily/image/1524297802609.jpeg", "netType": "NET_WIFI", "thingType": "DEVICE", "status": 0, "nodeType": "DEVICE", "owned": 1, "identityAlias": "我是东芝an001", "gmtCreate": "Jun 7, 2018 3:01:15 PM", "gmtModified": "Jun 7, 2018 3:14:48 PM", "roomInfo": { "spaceName": "房间1", "spaceOrder": 0, "houseId": "cFTOoq0qx6OGn9gvNBZV00001c5a10", "spaceId": "9ddb8753c18b40afa285b32e89ac3746" } } ], "pageSize": 30, "pageNo": 1, "total": 1 }
2.2. 更新常用设备列表
2.2.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/homelink/device/frequency/update | 1.0.0 | 更新常用设备列表 | 是 |
2.2.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
houseId | String | 是 | 房屋ID |
iotIdList | List | 是 | 设备ID列表 |
2.2.3. 返回参数
2.2.4. 示例
请求实例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "houseId": "houseId1234", "iotIdList": ["device1","device2"] } }
返回实例
{ "code": 200, "message": "success" }
2.3. 修改设备昵称
2.3.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/homelink/device/nickname/update | 1.0.0 | 修改设备昵称 | 是 |
2.3.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
iotId | String | 是 | 设备ID |
deviceNickname | String | 是 | 设备昵称 |
2.3.3. 返回参数
2.3.4. 示例
请求实例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "iotId": "iotId1234", "deviceNickname": "nickname" } }
返回实例
{ "code": 200, "message": "success" }
2.5. 解绑设备
2.5.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/homelink/device/unbind | 1.0.0 | 解绑设备 | 是 |
2.5.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
iotId | String | 是 | 设备ID |
2.5.3. 返回参数
2.5.4. 示例
请求实例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "iotId": "iotId1234" } }
返回实例
{ "code": 200, "message": "success" }
2.6. 转移设备到房间(在同一个家中)
2.6.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/homelink/room/device/change | 1.0.0 | 转移设备到房间 | 是 |
2.6.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
toRoomId | String | 是 | 新房间ID |
iotIdList | List | 是 | 转移设备ID |
2.6.3. 返回参数
2.6.4. 示例
请求实例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "toRoomId": "roomId1234", "iotIdList": ["device1","device2"] } }
返回实例
{ "code": 200, "message": "success" }
2.7. 获取房间下设备列表
2.7.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/homelink/room/device/list | 1.0.0 | 获取房间下设备列表 | 是 |
2.7.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
roomId | String | 是 | 房间ID |
nodeType | String | 否 | 查询的设备的节点类型:"DEVICE", "GATEWAY",null为全部 |
pageNo | Integer | 是 | 页码,从1开始,默认1 |
pageSize | Integer | 是 | 每页数据条数.默认为20. |
2.7.3. 返回参数
参数名 | 类型 | 说明 |
---|---|---|
data | List | 设备信息列表 |
total | Integer | 数据总数 |
2.7.4. 示例
请求实例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "roomId": "roomId1234", "nodeType": "DEVICE", "pageNo": 1, "pageSize": 20 } }
返回实例
{ "data": [ { "identityId": "5076al2344c628cf6dabb6137a7c3021cb3f4519", "iotId": "SwLa4NGAoEllg0TGzgAo0010bf1100", "productKey": "a1XHsQqSfck", "deviceName": "SwLa4NGAoEllg0TGzgAo", "productName": "测试", "categoryImage": "http://iotx-paas-admin.oss-cn-shanghai.aliyuncs.com/daily/image/1524297802609.jpeg", "nickName": "device_cc", "netType": "NET_WIFI", "thingType": "DEVICE", "status": 0, "nodeType": "DEVICE", "owned": 1, "identityAlias": "我是东芝an001", "gmtCreate": "Jun 7, 2018 3:00:16 PM", "gmtModified": "Jun 7, 2018 3:13:55 PM" } ], "pageSize": 20, "pageNo": 1, "total": 1 }
2.8. 管理员查看成员在房间下设备列表
2.8.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/homelink/room/member/device/list | 1.0.0 | 管理员查看成员在房间下的设备列表 | 是 |
2.8.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
roomId | String | 是 | 房间ID |
memberIdentityId | String | 是 | 成员用户ID |
nodeType | String | 否 | 查询的设备的节点类型:"DEVICE", "GATEWAY",null为全部 |
pageNo | Integer | 是 | 页码,从1开始,默认1 |
pageSize | Integer | 是 | 每页数据条数.默认为20. |
2.8.3. 返回参数
参数名 | 类型 | 说明 |
---|---|---|
data | List | 设备信息列表 |
total | Integer | 数据总数 |
2.8.4. 示例
请求实例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "roomId": "roomId1234", "memberIdentityId": "identityId1234", "nodeType": "DEVICE", "pageNo": 1, "pageSize": 20 } }
返回实例
{ "data": [ { "identityId": "5076al2344c628cf6dabb6137a7c3021cb3f4519", "iotId": "SwLa4NGAoEllg0TGzgAo0010bf1100", "productKey": "a1XHsQqSfck", "deviceName": "SwLa4NGAoEllg0TGzgAo", "productName": "测试", "categoryImage": "http://iotx-paas-admin.oss-cn-shanghai.aliyuncs.com/daily/image/1524297802609.jpeg", "nickName": "device_cc", "netType": "NET_WIFI", "thingType": "DEVICE", "status": 0, "nodeType": "DEVICE", "owned": 1, "identityAlias": "我是东芝an001", "gmtCreate": "Jun 7, 2018 3:00:16 PM", "gmtModified": "Jun 7, 2018 3:13:55 PM", "roomInfo": { "spaceName": "房间1", "spaceOrder": 0, "houseId": "cFTOoq0qx6OGn9gvNBZV00001c5a10", "spaceId": "9ddb8753c18b40afa285b32e89ac3746" } } ], "pageSize": 20, "pageNo": 1, "total": 1 }
2.9. 获取房屋下设备列表
2.9.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/homelink/house/device/list | 1.0.0 | 获取房屋下设备列表 | 是 |
2.9.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
houseId | String | 是 | 房屋ID |
nodeType | String | 否 | 查询的设备的节点类型:"DEVICE", "GATEWAY",null为全部 |
pageNo | Integer | 是 | 页码,从1开始,默认1 |
pageSize | Integer | 是 | 每页数据条数.默认为20. |
2.9.3. 返回参数
参数名 | 类型 | 说明 |
---|---|---|
data | List | 设备信息列表 |
total | Integer | 数据总数 |
2.9.4. 示例
请求实例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "houseId": "houseId1234", "nodeType": "DEVICE", "pageNo": 1, "pageSize": 20 } }
返回实例
{ "data": [ { "identityId": "5076al2344c628cf6dabb6137a7c3021cb3f4519", "iotId": "SwLa4NGAoEllg0TGzgAo0010bf1100", "productKey": "a1XHsQqSfck", "deviceName": "SwLa4NGAoEllg0TGzgAo", "productName": "测试", "categoryImage": "http://iotx-paas-admin.oss-cn-shanghai.aliyuncs.com/daily/image/1524297802609.jpeg", "nickName": "device_cc", "netType": "NET_WIFI", "thingType": "DEVICE", "status": 0, "nodeType": "DEVICE", "owned": 1, "identityAlias": "我是东芝an001", "gmtCreate": "Jun 7, 2018 3:00:16 PM", "gmtModified": "Jun 7, 2018 3:13:55 PM", "roomInfo": { "spaceName": "房间1", "spaceOrder": 0, "houseId": "cFTOoq0qx6OGn9gvNBZV00001c5a10", "spaceId": "9ddb8753c18b40afa285b32e89ac3746" } } ], "pageSize": 20, "pageNo": 1, "total": 1 }
3. 场景管理服务
3.1. 查询场景列表
3.1.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/list/get | 1.0.1 | 查询场景列表 | 是 |
3.1.2. 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
pageNo | Integer | 是 | 当前页号,从1开始的页序号 |
pageSize | Integer | 是 | 页大小,单页的item数量上限 |
groupId | String | 是 | 全屋的houseId |
3.1.3. 返回参数
参数 | 类型 | 描述 |
---|---|---|
total | Integer | 总条目数 |
pageNo | Integer | 当前页号,从1开始的页序号 |
pageSize | Integer | 页大小,单页的item数量上限 |
scenes | Array | 返回当前页条目 |
scenes.id | String | 场景id |
scene.status | Integer | 场景运行时状态 1 场景上线 2 场景下线 |
scene.enable | Boolean | true 场景置为打开,false场景置为关闭(App上的开关) |
scene.icon | String | 场景图标链接 |
scene.name | String | 场景名称,下图中条目上的实体名称 |
scene.description | String | 场景描述说明,下图中条目上灰色字 |
3.1.4. 使用说明
3.1.5. 示例
请求示例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "groupId": "houseId1234", "pageSize": 10, "pageNo": 1 } }
返回示例
{ "code": 200, "data": { "pageNo": 1, "pageSize": 20, "scenes": [{ "description": "电热毯-hy-信噪比--127 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "sceneId1", "name": "电热毯", "status": 2 }, { "description": "light-hy-LightSwitch-1, shuijin-hy-WiFI_SNR--127 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "sceneId2", "name": "凉宫", "status": 1 }, { "description": "fengsan-hy-PowerSwitch-关闭, light-hy-LightSwitch-1 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "sceneId3", "name": "风扇灯0522", "status": 1 }, { "description": "light-hy-LightSwitch-1 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "sceneId4", "name": "灯0522", "status": 2 }, { "description": "fengsan-hy-PowerSwitch-关闭 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "sceneId5", "name": "的", "status": 1 }, { "description": "light-hy-LightSwitch-1, light-hy-LightSwitch-1 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "sceneId6", "name": "两个灯0522", "status": 2 }, { "description": "light-hy-LightSwitch-1 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "sceneId7", "name": "灯", "status": 2 }, { "description": "light-hy-LightSwitch-1, light-hy-LightSwitch-1 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "sceneId8", "name": "两个灯", "status": 2 }, { "description": "light-hy-LightSwitch-1 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "sceneId9", "name": "灯", "status": 2 }, { "description": "light-hy-NightLightSwitch-关闭1 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "sceneId10", "name": "测", "status": 2 }], "total": 33 }, "message": "success" }
3.2. 改变场景列表中表项的排序
3.2.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/list/reorder | 1.0.1 | 改变场景列表中表项的排序 | 是 |
3.2.2. 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
newOrders | Array | 是 | 序号变化的场景数组 |
newOrders.sceneId | String | 是 | 场景id |
newOrders.fromOrder | Integer | 是 | 顺序变化前的序号 |
newOrders.toOrder | Integer | 是 | 新的序号 |
groupId | String | 是 | 全屋的houseId |
3.2.3. 返回参数
参数 | 类型 | 描述 |
---|---|---|
3.2.4. 示例
请求实例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "groupId": "houseId1234", "newOrders": [{ "fromOrder": 1, "sceneId": "sceneId1", "toOrder": 2 }, { "fromOrder": 2, "sceneId": "sceneId1", "toOrder": 1 }] } }
返回实例
{ "code": 200, "message": "success" }
3.3. 触发场景
3.3.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/fire | 1.0.1 | 触发场景 |
3.3.2. 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
sceneId | String | 是 | 待触发的场景id |
groupId | String | 是 | 房屋id在全屋时需要带 |
3.3.3. 返回参数
参数 | 类型 | 描述 |
---|---|---|
sceneId | String | 触发的场景id |
3.3.4. 示例
请求实例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "groupId": "house1234", "sceneId": "sceneId1" } }
返回实例
{ "code": 200, "data": "sceneId1", "message": "success" }
3.4. 获取场景日志列表
3.4.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/log/list/get | 1.0.1 | 获取场景日志列表 | 是 |
3.4.2. 请求参数
场景日志查询的方式:
场景日志需要指定一个查询的时间起点,定义为T1,后端会查从T1开始向前追溯15天的日志,即
[T1-15*3600*24, T1] 这个时间段之间的日志
故约定:App端打开日志查询的界面时,记录下页面打开的时间点作为T1,在后续的查询中,一直携带T1作为nowTime。
如果页面要查看T1之后的某个时间点开始的Log,需要重新指定此时的时间点T2,并且把已查询到的结果全部删除掉,令pageNo=1,重新开始查询。
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
pageNo | Integer | 是 | 当前页号,从1开始的页序号 |
pageSize | Integer | 是 | 页大小,单页的item数量上限 |
nowTime | Long | 是 | 查询日志的起始时间,参考场景日志查询的方式。单位毫秒 |
groupId | String | 是 | 房屋的id |
3.4.3. 返回参数
参数 | 类型 | 描述 |
---|---|---|
pageNo | Integer | 当前页号,从1开始的页序号 |
pageSize | Integer | 页大小,单页的item数量上限 |
total | Integer | 总数 |
logs | Array | 日志列表,按时间从大到小返回 |
logs.time | Long | 日志时间,时间戳,单位毫秒 |
logs.icon | String | 场景图标 |
logs.sceneId | String | 场景id |
logs.id | String | 日志id |
logs.sceneName | String | 场景名称 |
logs.result | Integer | 执行结果 0 失败 1成功 |
3.4.4. 示例
请求示例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "pageNo": 1, "pageSize": 10, "groupId": "house1234", "nowTime": 1527129084824 } }
返回示例
{ "code": 200, "data": { "logs": [{ "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15270912000056576d52bf", "result": 0, "sceneId": "sceneId1", "sceneName": "t时间设备", "time": 1527091200000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15270912000056577d52bf", "result": 0, "sceneId": "sceneId2", "sceneName": "t时间", "time": 1527091200000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15270912000036575d52bf", "result": 0, "sceneId": "sceneId3", "sceneName": "测", "time": 1527091200000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15270912000056578d52bf", "result": 0, "sceneId": "sceneId4", "sceneName": "t时间设备", "time": 1527091200000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15270549875871014d52bf", "result": 1, "sceneId": "sceneId5", "sceneName": "灯", "time": 1527054987000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15269604322384548d3112", "result": 1, "sceneId": "sceneId6", "sceneName": "灯0522", "time": 1526960432000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15269550384782579d3112", "result": 1, "sceneId": "sceneId7", "sceneName": "灯", "time": 1526955038000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15269550370082578d3112", "result": 1, "sceneId": "sceneId8", "sceneName": "两个灯0522", "time": 1526955037000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15269550356242576d3112", "result": 1, "sceneId": "sceneId9", "sceneName": "灯", "time": 1526955035000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15269550340772575d3112", "result": 1, "sceneId": "sceneId10", "sceneName": "两个灯0522", "time": 1526955034000 }], "pageNo": 1, "pageSize": 10, "total": 62 }, "message": "success" }
3.5. 获取失败日志详情
3.5.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/failedlog/get | 1.0.3 | 获取失败日志详情 | 是 |
3.5.2. 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
logId | String | 是 | 待查询的日志id |
sceneId | String | 是 | 场景id |
time | Long | 是 | /scene/log/list/get 返回的logs.time 单位毫秒 |
groupId | String | 是 | 房屋id |
pageNo | Integer | 是 | 当前页号,从1开始的页序号 |
pageSize | Integer | 是 | 页大小,单页的item数量上限 |
3.5.3. 返回参数
参数
|
类型
|
描述
|
details
|
Array
|
|
details.productKey
|
String
|
失败设备的详情列表
|
details.localizedProductName
|
String
|
本地化的产品信息
|
details.deviceName
|
String
|
设备的deviceName
|
details.aliasName
|
String
|
用户给设备起的名称
|
details.failedReason
|
String
|
错误信息,格式
如果action是设置属性,则文案拼接规则是:{产品名称}-{属性名}-{属性值} 执行失败
如果action是调用服务,则文案拼接规则是:{产品名称}-{服务名称} 执行失败
|
details.detail
|
String
|
下标注释的原因
|
details.icon
|
String
|
图标
|
pageNo
|
Integer
|
当前页号,从1开始的页序号
|
pageSize
|
Integer
|
页大小,单页的item数量上限
|
total
|
Integer
|
总数
|
3.5.4. 示例
请求示例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "pageNo": 1, "pageSize": 1000, "groupId": "houseId1234", "logId": "0bc19f5d15270912000056576d52bf", "sceneId": "sceneId1", "time": 1527091200000 } }
应答示例
{ "code": 200, "data": { "details": [{ "detail": "light-hy - NightLightSwitch - 关闭1 设置设备参数", "deviceName":"1yhy", "failedReason": "device in scene's action is unbind", "productKey": "product" }], "pageNo": 1, "pageSize": 1000 }, "message": "success" }
3.6. 获取场景详情
3.6.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/info/get | 1.0.1 | 获取场景详情 | 是 |
3.6.2. 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
sceneId | String | 是 | 待查询的场景Id |
groupId | String | 是 | 房屋id |
3.6.3. 返回参数
参数 | 类型 | 描述 |
---|---|---|
sceneId | String | 场景id |
enable | Boolean | true打开 false关闭 |
status | Integer | 场景运行时状态,1运行 2失效 |
name | String | 用户给场景起的名称 |
icon | String | 场景图标 |
triggers | Object | triggers对象的String。triggers对象定义在下面 |
conditions | Object | conditions对象的String |
actions | Array | actions对象的String |
3.6.4. triggers对象的定义
triggers.uri | String | 目前只支持"logical/or" |
---|---|---|
triggers.params | Object | triggers整体参数,暂时没有用 |
triggers.items | Array | triggers条目列表 |
Triggers Item的结构定义
触发器-设备状态
{
"params": {
"localizedProductName": "电热毯-hy", // 产品本地描述
"iotId": "SYxxxxxxxxxxxxxz00103d0c00", // 设备id
"localizedPropertyName": "信噪比", // 属性本地描述
"localizedCompareValueName": "开启", // 比较值的本地描述
"productImage": "http://" // 产品图标
"deviceNickName": "电热毯", // 设备昵称
"propertyName": "WiFI_SNR", // 属性名
"compareType": ">", // 比较类型,支持>, >=, ==,<=,<, !=,in,like等
"compareValue": 1, // 属性值
"productKey": "b1xxxxxxUql", // pk
"deviceName": "hyxxxxx4" // 设备名称
},
"uri": "trigger/device/property"
}
触发器-定时器
{
"params": {
"cron": "1 1 * * *",
"cronType": "linux",
"timezoneID": "Asia/Shanghai" // 时区id,默认为'Asia/Shanghai'
},
"uri": "trigger/timer"
}
3.6.5. conditions对象的定义
conditions.uri | String | 目前只支持"logical/and" |
---|---|---|
conditions.items | Array | conditions条目列表 |
Conditions Item的结构定义
条件节点-时间区间判断
{
"uri": "logical/and",
"items": [{
"params": {
"cron": "20-25 11-23 * * 1,2,3,4,5,6,7",
"cronType": "linux",
"timezoneID": "Asia/Shanghai"
},
"uri": "condition/timeRange"
}]
}
条件节点-设备属性数据
{
"params": {
"localizedProductName": "电热毯-hy", // 产品本地描述
"localizedPropertyName": "信噪比", // 属性本地描述
"localizedCompareValueName": "开启", // 比较值的本地描述
"deviceNickName": "电热毯", // 设备昵称
"iotId": "SY7a6xxxxxxxxxxxxxxxd0c00", // 设备id
"productImage": "http://" // 产品图标
"propertyName": "WiFI_SNR", // 属性名
"compareType": "==", // 比较类型,支持>, >=, ==,<=,<, !=,in,like等
"compareValue": 1, // 属性值
"productKey": "b1xxxxxxql", // pk
"deviceName": "hyxxxx4" // 设备名称
},
"uri": "condition/device/property"
}
3.6.6. actions 对象定义
动作-设置设备状态
{
"params": {
"localizedProductName": "电热毯", // 产品本地描述
"iotId": "SYxxxxxxxxxxxxxxxxxc00", // 设备id
"propertyName": "WiFI_SNR", // 属性名
"localizedPropertyName": "信噪比", // 属性本地描述
"deviceNickName": "电热毯-hy",// 设备昵称
"productImage": "http://" // 产品图标
"propertyValue": -127, // 属性值
"productKey": "b1xxxxxxxxql", // pk
"deviceName": "hyxxxxx4" // 设备名称
},
"uri": "action/device/setProperty",
"status": 0 //表示设备状态:0:无效,1:有效,用于展示场景的时候对失效设备置灰
}
动作节点-向终端发消息
{
"uri": "action/mq/send",
"params": {
"msgTag": "iot_linkvision_storage_record_start",
"customData": "hello world"
}
}
动作节点-开关场景开关 0关1开
{
"uri": "action/automation/setSwitch",
"params": {
"automationRuleId": "scenId",
"switchStatus": 0
}
}
3.6.7. 示例
请求示例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "sceneId": "26xxxxxxxxxxxxxxxxxx [1be22", "groupId": "houseId1234" } }
返回示例
{ "code": 200, "data": { "triggers": { "params": {}, "items": [{ "params": { "localizedProductName": "智能开关-单键", "localizedPropertyName": "电源开关_1", "deviceNickName": "开关-单键", "iotId": "v9Oxxxxxxxxxxxxxxxxxxx00", "compareValue": 1, "compareType": "==", "propertyName": "PowerSwitch_1", "localizedCompareValueName": "开启", "productImage": "http://ueim_em.tn", "productKey": "a1xxxxxxxx3S", "deviceName": "ZFxxxxxxxx003" }, "uri": "trigger/device/property" }], "uri": "logical/or" }, "condition": { "uri": "logical/and", "items": [{ "params": { "cron": "1-1 10-18 * * 1,2,4,6,7", "cronType": "linux", "timezoneID": "Asia/Shanghai" }, "uri": "condition/timeRange" }], "actions": [{ "uri": "action/scene/trigger", "params": { "name": "场景", "sceneId": "3cdxxxxxxxxxxxxxxxxxxxxxxxxxx850", "icon": "http://" } }, { "params": { "localizedProductName": "电热毯", "iotId": "SY7xxxxxxxxxxxxxxxxxxxxxx0c00", "propertyName": "WiFI_SNR", "localizedPropertyName": "信噪比", "deviceNickName": "电热毯", "productImage": "http://bourn_ess.tn", "propertyValue": -127, "productKey": "b1xxxxxxql", "deviceName": "hyxxxxx4" }, "uri": "action/device/setProperty", "status": 1 }], "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "name": "电热毯", "sceneId": "26xxxxxxxxxxxxxxxxxxbe22", "status": 2 }, "message": "success" } }
3.7. 创建场景
3.7.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/create | 1.0.1 | 创建场景 | 是 |
3.7.2. 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
groupId | String | 是 | 房屋的Id |
enable | Boolean | 是 | true打开 false关闭 |
name | String | 是 | 用户给场景起的名称 |
icon | String | 是 | 场景图标 |
triggers | Object | 否 | trigger对象 |
conditions | Object | 否 | condition对象 |
actions | Array | 是 | action对象 |
注:action不能为空,trigger可以空,condition可以空
3.7.3. 返回参数
参数 | 类型 | 描述 |
---|---|---|
sceneId | String | 创建的场景Id |
Triggers对象的定义
triggers.uri | String | 目前只支持"logical/or" |
---|---|---|
triggers.params | Object | triggers整体参数,暂时没有用 |
triggers.items | Array | triggers条目列表 |
触发器-设备状态
{
"params": {
"iotId": "SY7xxxxxxxxxxxxxxxxxxxx0c00", // 设备id
"propertyName": "WiFI_SNR", // 属性名
"compareType": ">", // 比较条件
"compareValue": -127, // 属性值
},
"uri": "trigger/device/property"
}
触发器-定时器
{
"params": {
"cron": "1 1 * * *",
"cronType": "linux",
"timezoneID": "Asia/Shanghai"
},
"uri": "trigger/timer"
}
conditions对象的定义
conditions.uri | String | 目前只支持"logical/and" |
---|---|---|
conditions.items | Array | conditions条目列表 |
条件节点-时间区间判断
{
"uri": "logical/and",
"items": [{
"params": {
"cron": "20-25 11-23 * * 1,2,3,4,5,6,7",
"cronType": "linux",
"timezoneID": "Asia/Shanghai"
},
"uri": "condition/timeRange"
}]
}
条件节点-设备属性数据
{
"params": {
"iotId": "SY7xxxxxxxxxxxxxxxxxxxxx00", // 设备id
"propertyName": "WiFI_SNR", // 属性名
"compareValue": -127, // 属性值
"compareType": ">", // 比较条件
},
"uri": "condition/device/property"
}
actions 对象定义
动作-设置设备状态
{
"params": {
"iotId": "SYxxxxxxxxxxxxxxxxxxxxxxxx00", // 设备id
"propertyName": "WiFI_SNR", // 属性名
"propertyValue": -127, // 属性值
},
"uri": "action/device/setProperty"
}
动作节点-向终端发消息
{
"uri": "action/mq/send",
"params": {
"msgTag": "iot_linkvision_storage_record_start",
"customData": "hello world"
}
}
动作节点-开关场景开关 0关1开
{
"uri": "action/automation/setSwitch",
"params": {
"automationRuleId": "scenId",
"switchStatus": 0
}
}
3.7.4. 示例
请求示例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "groupId":"houseId123", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "name": "一样", "triggers": { "params": {}, "items": [{ "params": { "compareValue": 1, "iotId": "Kpxxxxxxxxxxxxxxxxxxxxx00", "compareType": "==", "propertyName": "ContactState" }, "uri": "trigger/device/property" }, { "params": { "cron": "1 1 * * *", "cronType": "linux", "timezoneID": "Asia/Shanghai" }, "uri": "trigger/timer" } ], "uri": "logical/or" }, "conditions": { "items": [{ "params": { "compareValue": 0, "iotId": "gaIxxxxxxxxxxxxxxxxxxxx00", "compareType": "==", "propertyName": "LightSwitch" }, "uri": "condition/device/property", "status": 1 }], "uri": "logical/and" }, "actions": [{ "params": { "iotId": "zjxxxxxxxxxxxxxxxxxxxxx00", "propertyName": "Qu0wChfloat", "propertyValue": 1 }, "uri": "action/device/setProperty" }] } }
返回示例
{ "code": 200, "data": "dexxxxxxxxxxxxxxxxxxxxxc2", "message": "success" }
3.8. 更新场景
3.8.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/update | 1.0.1 | 更新场景 | 是 |
3.8.2. 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
groupId | String | 是 | 房屋的Id |
sceneId | String | 是 | 场景Id |
enable | Boolean | 是 | true打开 false关闭 |
name | String | 是 | 用户给场景起的名称 |
icon | String | 是 | 场景图标 |
triggers | Object | 否 | trigger对象 |
conditions | Object | 否 | condition对象 |
actions | Array | 是 | action对象 |
3.8.3. 返回参数
参数 | 类型 | 描述 |
---|---|---|
sceneId | String | 更新的场景Id |
*更新场景的tca定义和创建场景的tca定义相同
3.8.4. 示例
请求示例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "groupId":"houseId123", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "name": "", "sceneId": "bdc6xxxxxxxxxxxxxxxxxx697", "triggers": { "params": {}, "items": [{ "params": { "compareValue": 1, "iotId": "Kpxxxxxxxxxxxxxxxxxxxxx00", "compareType": "==", "propertyName": "ContactState" }, "uri": "trigger/device/property" }, { "params": { "cron": "0 0 * * *", "cronType": "linux", "timezoneID": "Asia/Shanghai" }, "uri": "trigger/timer" } ], "uri": "logical/or" }, "conditions": { "items": [{ "params": { "compareValue": 0, "iotId": "gaIxxxxxxxxxxxxxxxxxxxx00", "compareType": "==", "propertyName": "LightSwitch" }, "uri": "condition/device/property", "status": 1 }], "uri": "logical/and" }, "actions": [{ "params": { "iotId": "gaIxxxxxxxxxxxxxxxxxxxx00", "propertyName": "NightLightSwitch", "propertyValue": 0 }, "uri": "action/device/setProperty", "status": 1 }] } }
返回示例
{ "code": 200, "data": "bdc6xxxxxxxxxxxxxxxxxx697", "message": "success" }
3.9. 删除场景
3.9.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/delete | 1.0.1 | 删除场景 | 是 |
3.9.2. 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
groupId | String | 是 | 房屋的Id |
sceneId | String | 是 | 场景Id |
3.9.3. 返回参数
参数 | 类型 | 描述 |
---|---|---|
sceneId | String | 删除的场景Id |
3.9.4. 示例
请求示例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "sceneId": "0c9xxxxxxxxxxxxxxxxxxxx657", "groupId": "houseId1234" } }
返回示例
{ "code": 200, "data": "0c9xxxxxxxxxxxxxxxxxxxx657", "message": "success" }
3.10. 房屋管理员为用户分配场景权限
3.10.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/member/bind/modify | 1.0.4 | 房屋管理员为用户分配场景权限 | 是 |
3.10.2. 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
groupId | String | 是 | 房屋的Id |
targetIdentityId | String | 是 | 待分配权限的用户id |
sceneIds | List | 是 | 待分配的权限列表 |
action | String | 是 | bind/unbind 绑定/解绑 |
3.10.3. 返回参数
参数 | 类型 | 描述 |
---|---|---|
3.10.4. 示例
请求示例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "targetIdentityId": "5029op6f2c030c839xxxxxxb906282", "groupId": "0BH05hTH7j6Kdw4xxxx510", "action": "bind", "sceneIds": [ "13ae01395f72xxxx3bd5bdc6" ] } }
返回示例
{ "code": 200, "message": "success" }
3.11. 房屋管理员查询成员场景权限列表
注:这个列表是房屋下的所有场景列表
3.11.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/member/binding/list | 1.0.4 | 房屋管理员查询成员场景权限 | 是 |
3.11.2. 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
groupId | String | 是 | 房屋的Id |
targetIdentityId | String | 是 | 待查询权限的用户id |
pageNo | Integer | 是 | 当前页号,从1开始的页序号 |
pageSize | Integer | 是 | 页大小,单页的item数量上限 |
3.11.3. 返回参数
参数 | 类型 | 描述 |
---|---|---|
total | Integer | 总记录数 |
pageNo | Integer | 当前页号,从1开始的页序号 |
pageSize | Integer | 页大小,单页的item数量上限 |
data | List | 该用户拥有权限的场景列表 |
data.sceneId | String | 场景id |
data.name | String | 场景名称 |
data.gmt_createTime | Long | 创建创建的时间戳,到毫秒 |
data.accessible | Boolean | true用户拥有这个场景的访问权限 |
3.11.4. 示例
请求示例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "targetIdentityId": "5029op6f2c030xxxx11794e662b906282", "pageNo": 1, "groupId": "0BH05hTH7xxxxx000218510", "pageSize": 10 } }
返回示例
{ "code": 200, "data": { "data": [ { "accessible": false, "description": "灯-虚拟设备-人居接口测试专用-工作模式-柔和", "gmtCreate": 1533125161000, "icon": "https://g.aliplus.com/scene_icons/holiday.png", "name": "小憩", "sceneId": "13ae01395f724xxxx463bd5bdc6" } ], "pageNo": 1, "pageSize": 10, "total": 5 }, "message": "success" }
3.12.1. 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/unbind | 1.0.0 | 房屋普通用户取消与场景的绑定 | 是 |
3.12.2. 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
groupId | String | 是 | 房屋的Id |
sceneIds | List | 是 | 待取消权限的场景id列表 |
3.12.3. 返回参数
参数 | 类型 | 描述 |
---|---|---|
注:
- 普通用户拉取其场景列表,使用/scene/list/get
- 管理员没有取消自己权限的操作,直接调用删除场景,删除后其他成员也看不到该场景
3.12.4. 示例
请求示例
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "groupId": "0BH05hTH7xxxxZI0000218510", "sceneIds": [ "13ae01395f724xxxxxbd5bdc6" ] } }
返回示例
{ "code": 200, "message": "success" }
3.13 获取支持Trigger/Condition/Action的设备列表</span>
3.13.1 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/thing/list | 1.0.3 | 查询获取支持T/C/A的设备列表 | 是,客户端SDK需启用身份的鉴权 |
3.13.2 请求参数
参数
|
类型
|
必填
|
描述
|
flowType
|
Integer
|
是
|
流程类型
0:trigger
1:condition
2:action
|
pageNum
|
Integer
|
是
|
分页页数,从1开始
|
pageSize
|
Integer
|
是
|
分页页面大小
|
groupId
|
String
|
是
|
房屋的houseId
|
3.13.3 返回参数
参数 | 类型 | 必有 | 描述 |
---|---|---|---|
pageNo | Integer | 是 | 从1开始的页序号 |
pageSize | Integer | 是 | 单页的item数量上限 |
total | Long | 是 | 总记录数 |
data | List |
否 | 设备列表 |
DeviceInfoDTO结构
参数 | 类型 | 描述 |
---|---|---|
iotId | String | 设备ID |
deviceName | String | 设备deviceName |
productKey | String | 产品productKey |
nickName | String | 设备昵称 |
image | String | 品类图标URL |
1.13.4 示例
请求示例
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.1",
"iotToken": "token"
},
"params": {
"groupId":"diemxxxxemieniadsemie",
"flowType": 0,
"pageNum": 1,
"pageSize": 20
}
}
返回示例
{
"code": 200,
"data": {
"pageNo": 1,
"pageSize": 20,
"total":1,
"data": [{
"iotId": "45dc6fc753d345b69b01d29f6974e5f7",
"deviceName": "xxxx",
"productKey": "xxxx",
"nickName": "测试设备",
"image": "https://g.aliplus.com/scene_icons/default.png"
}]
},
"message": "success"
}
3.14 获取设备的Trigger/Condition/Action功能列表</span>
3.14.1 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/iotid/scene/ability/list | 1.0.3 | 查询设备支持T/C/A的功能列表信息 | 是,客户端SDK需启用身份的鉴权 |
3.14.2 请求参数
参数
|
类型
|
必填
|
描述
|
iotId
|
String
|
是
|
设备ID
|
flowType
|
Integer
|
是
|
流程类型
0:trigger
1:condition
2:action
|
3.14.3 返回参数
参数
|
类型
|
必有
|
描述
|
name
|
String
|
是
|
功能名称
|
identifier
|
String
|
是
|
功能标识符
|
categoryType
|
String
|
是
|
品类名称
|
type
|
Integer
|
否
|
功能类型
1: 属性,
2:服务,
3:事件
|
3.14.4示例
请求示例
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.1",
"iotToken": "token"
},
"params": {
"iotId": "45dc6fc753d345b69b01d29f6974e5f7",
"flowType": 0
}
}
返回示例
{
"code": 200,
"data": [{
"name": "开关",
"identifier": "switch",
"categoryType": "xxxx",
"type": 1
}],
"message": "success"
}
3.15 获取设备的Trigger/Condition/Action功能列表与TSL定义</span>
3.15.1 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/iotid/scene/ability/tsl/list | 1.0.3 | 查询设备支持T/C/A的功能列表信息以及对应设备的TSL信息 | 是,客户端SDK需启用身份的鉴权 |
3.15.2 请求参数
参数
|
类型
|
必填
|
描述
|
iotId
|
String
|
是
|
设备ID
|
flowType
|
Integer
|
是
|
流程类型
0:trigger
1:condition
2:action
|
3.15.3 返回参数
参数 | 类型 | 必有 | 描述 |
---|---|---|---|
simplifyAbilityDTOs | List |
是 | 功能定义列表 |
abilityDsl | JSONObject | 是 | 产品功能TSL(参考) |
SimplifyAbilityDTOs结构
参数
|
类型
|
必有
|
描述
|
name
|
String
|
是
|
功能名称
|
identifier
|
String
|
是
|
功能标识符
|
categoryType
|
String
|
是
|
品类名称
|
type
|
Integer
|
否
|
功能类型
1: 属性,
2:服务,
3:事件
|
3.15.4 示例
请求示例
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.1",
"iotToken": "token"
},
"params": {
"iotId": "45dc6fc753d345b69b01d29f6974e5f7",
"flowType": 0
}
}
返回示例
{
"code": 200,
"data": {
"simplifyAbilityDTOs":[{
"name": "开关",
"identifier": "switch",
"categoryType": "xxxx",
"type": 1
}],
"abilityDsl": {}
},
"message": "success"
}
3.16. 替换房屋内场景用到的设备
3.16.1 定义描述
path | 版本 | 描述 | 是否需要登录 |
---|---|---|---|
/scene/device/replace | 1.0.5 | 替换房屋内场景用到的设备 | 是 |
3.16.2 请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
fromIotId | String | 是 | 原设备ID |
toIotId | String | 是 | 现在的设备ID |
groupId | String | 是 | 房屋id |
3.16.3 返回参数
参数 | 类型 | 描述 |
---|---|---|
提供一组访问、控制房屋/房间相关的服务,客户端应用可以通过该服务实现获取房屋列表、获取房屋下的房间列表、新增房间、获取房间详情、房间排序等功能。
4.1. 获取房屋列表
4.1.1. 定义描述
path | 版本 | 描述 | 是否需要登陆 |
---|---|---|---|
/homelink/house/list | 1.0.0 | 获取当前登录用户的房屋列表 | 是 |
4.1.2. 请求参数
参数字段名
|
类型
|
是否必须
|
参数说明
|
pageNo
|
Integer
|
是
|
当前页号,从1开始的页序号。
但是有默认值,不填默认为0
|
pageSize
|
Integer
|
是
|
单页的item数量页大小,单页的item数量上限.
有默认值,不填默认为10
|
4.1.3. 返回参数
返回字段名
|
类型
|
说明
|
total
|
Integer
|
云端总数
|
data
|
List<HouseBriefDTO>
|
房屋的列表
|
HouseBriefDTO.houseId
|
String
|
房屋ID
|
HouseBriefDTO.houseName
|
String
|
房屋名称
|
HouseBriefDTO.role
|
Integer
|
当前用户角色
1: 管理员
2: 普通用户
|
4.1.4. 示例
请求示例
{ "request": { "iotToken": "109049c80bcde4c06b15f6f62e29a3ba", "apiVer": "1.0.0" }, "id": 1508212818676, "params": { "pageNo":1, "pageSize":10 }, "version": "1.0" }
返回示例
{ "code": 200, "data": { "total":100, "data":[ { "houseId":"xxxx", "houseName":"201幢201单元201室", "role":1 } ] }, "message":"success" }
4.2. 获取房屋下房间列表
4.2.1. 定义描述
path | 版本 | 描述 | 是否需要登陆 |
---|---|---|---|
/homelink/room/list | 1.0.0 | 获取当前登录用户的房屋下房间列表 | 是 |
4.2.2. 请求参数
参数名 | 类型 | 是否必须 | 说明 |
---|---|---|---|
houseId | String | 是 | 房屋ID |
pageNo | Integer | 是 | 页码 |
pageSize | Integer | 是 | 每页条数 |
4.2.3. 返回参数
参数名 | 类型 | 说明 |
---|---|---|
total | Integer | 云端总数 |
data | List | 房间列表 |
RoomInfoDTO.roomId | String | 房间ID |
RoomInfoDTO.roomName | String | 房间名称 |
RoomInfoDTO.roomOrder | Integer | 房间顺序号 |
RoomInfoDTO.roomPicture | String | 房间壁纸URL地址 |
RoomInfoDTO.deviceCount | Integer | 房间内设备数量 |
4.2.4. 示例
- 请求示例
{
"request": {
"iotToken": "xxxx",
"apiVer": "1.0.0"
},
"id": "xxx-xxx-xxx-xxx-xxx",
"params": {
"houseId":"xxxx",
"pageNo":1,
"pageSize":10
},
"version": "1.0"
}
- 返回示例
{
"code": 200,
"data": {
"total":1,
"data":[
{
"roomId":"xxx",
"roomName":"201幢201单元201室",
"roomOrder":1,
"roomPicture":"http://xxx.com/xx.png",
"deviceCount":5
}
]
},
"message":"success"
}
4.3. 修改房屋下房间的排序
4.3.1. 定义描述
path | 版本 | 描述 | 是否需要登陆 |
---|---|---|---|
/homelink/room/order/update | 1.0.0 | 房屋下的房间列表展示,支持排序功能,此接口用来对房屋下的房间进行自定义排序 | 是 |
4.3.2. 请求参数
参数名 | 类型 | 是否必须 | 说明 |
---|---|---|---|
houseId | String | 是 | 房屋ID |
orderList | JSONArray | 是 | 空间排序有变化的数据 |
orderList.roomId | String | 是 | 房间ID |
orderList.fromOrder | Integer | 是 | 顺序变化前的order |
orderList.toOrder | Integer | 是 | 顺序变化后的order |
4.3.3. 返回参数
无
4.3.4. 示例
- 请求示例
```json
{
"request": {
}, "id": "xxx-xxx-xxx-xxx-xxx", "params": {"iotToken": "xxxx", "apiVer": "1.0.0"
}, "version": "1.0" }"houseId":"xxxx", "orderList":[{"roomId":"xx", "fromOrder":1, "toOrder":2}]
* 返回示例
```json
{
"code":200,
"message":"success"
}
4.4. 获取房间详情
4.4.1. 定义描述
path | 版本 | 描述 | 是否需要登陆 |
---|---|---|---|
/homelink/room/detail/get | 1.0.0 | 获取房间详情 | 是 |
4.4.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
roomId | String | 是 | 房间id |
houseId | String | 是 | 房屋id |
4.4.3. 返回参数
参数名 | 类型 | 说明 |
---|---|---|
roomName | String | 房间信息 |
roomId | String | 房间id |
roomOrder | Integer | 房间顺序 |
roomPicture | String | 房间壁纸 |
4.4.4. 示例
- 请求示例
```json
{
"request": {
}, "id": "xxx-xxx-xxx-xxx-xxx", "params": {"iotToken": "xxxx", "apiVer": "1.0.0"
}, "version": "1.0" }"roomId":"xxxx"
* 返回示例
```json
{
"code":200,
"data":{
"roomId":"xxx",
"roomName":"201幢201单元201室",
"roomOrder":1,
"roomPicture":"http://xxx.com/xx.png",
"deviceCount":5
},
"message":"success"
}
4.5. 修改房间信息
4.5.1. 定义描述
path | 版本 | 描述 | 是否需要登陆 |
---|---|---|---|
/homelink/room/detail/update | 1.0.0 | 修改指定房间的信息 | 是 |
4.5.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
roomId | String | 是 | 房间ID |
roomName | String | 否 | 房间名称 |
roomPicture | String | 否 | 房间壁纸 |
4.5.3. 返回参数
无
4.5.4. 示例
- 请求示例
```json
{
"request": {
}, "id": "xxx-xxx-xxx-xxx-xxx", "params": {"iotToken": "xxxx", "apiVer": "1.0.0"
}, "version": "1.0" }"roomId":"xxx", "roomName":"201幢201单元201室", "roomPicture":"http://xxx.com/xx.png",
* 返回示例
```json
{
"code":200,
"message":"success"
}
4.6. 新建房间
4.6.1. 定义描述
path | 版本 | 描述 | 是否需要登陆 |
---|---|---|---|
/homelink/room/create | 1.0.0 | 在房屋下新建房间 | 是 |
4.6.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
houseId | String | 是 | 房屋ID |
roomName | String | 是 | 房间名称 |
roomPicture | String | 否 | 房间壁纸URL地址 |
deviceIdList | List | 否 | 设备ID列表 |
4.6.3. 返回参数
字段名 | 类型 | 参数说明 |
---|---|---|
data | String | 房间id |
code | Integer | 返回码 |
message | String | 提示信息 |
4.6.4. 示例
- 请求示例
```json
{
"request": {
}, "id": "xxx-xxx-xxx-xxx-xxx", "params": {"iotToken": "xxxx", "apiVer": "1.0.0"
}, "version": "1.0" }"houseId":"xxx", "roomName":"201幢201单元201室", "roomPicture":"http://xxx.com/xx.png", "deviceList":["xxxx","xxxxx"]
* 返回示例
```json
{
"code":200,
"message":"success",
"data":"xxxxx"
}
4.7. 删除房间
4.7.1. 定义描述
path | 版本 | 描述 | 是否需要登陆 |
---|---|---|---|
/homelink/room/delete | 1.0.0 | 删除房屋下的房间 | 是 |
4.7.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
houseId | String | 是 | 房屋ID |
roomId | String | 是 | 房间ID |
4.7.3. 返回参数
见返回示例
4.7.4. 示例
- 请求示例
```json
{
"request": {
}, "id": "xxx-xxx-xxx-xxx-xxx", "params": {"iotToken": "xxxx", "apiVer": "1.0.0"
}, "version": "1.0" }"houseId":"xxx", "roomId":"201幢201单元201室"
* 返回示例
```json
{
"code":200,
"message":"success"
}
4.8. 获取房间默认壁纸列表
4.8.1. 定义描述
path | 版本 | 描述 | 是否需要登陆 |
---|---|---|---|
/homelink/room/default/picture/list | 1.0.0 | 获取房间的默认壁纸URL列表 | 无 |
4.8.2. 请求参数
无
4.8.3. 返回参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
type | String | 是 | 房屋ID |
urlList | String | 是 | 房间ID |
参数名 | 类型 | 说明 |
---|---|---|
type | String | 类型,房屋壁纸为ROOM_DEFAULT_PICTURE |
urlList | List | 壁纸URL地址列表 |
4.8.4. 示例
- 请求示例
```json
{
"request": {
}, "id": "xxx-xxx-xxx-xxx-xxx", "params": {"iotToken": "xxxx", "apiVer": "1.0.0"
}, "version": "1.0" }"houseId":"xxx", "roomId":"201幢201单元201室"
* 返回示例
```json
{
"code":200,
"data":[
{"type":"ROOM_DEFAULT_PICTURE","urlList":["https://img.alicdn.com/tfs/TB1FJwJSFXXXXczXXXXXXXXXXXX-750-1334.jpg"]},
{"type":"HOUSE_DEFAULT_PICTURE", "urlList":["https://img.alicdn.com/tfs/TB1FJwJSFXXXXczXXXXXXXXXXXX-750-1334.jpg"]}
],
"message":"success"
}
4.9. 获取房屋详情
4.9.1. 定义描述
path | 版本 | 描述 | 是否需要登陆 |
---|---|---|---|
/homelink/house/detail/get | 1.0.4 | 获取指定房屋详情 | 是 |
4.9.2. 请求参数
参数字段名 | 类型 | 是否必须 | 参数说明 |
---|---|---|---|
houseId | String | 是 | 房屋ID |
4.9.3. 返回参数
参数字段名 | 类型 | 参数说明 |
---|---|---|
houseId | String | 房屋ID |
houseName | String | 房屋名称 |
address | json | 房屋地址 |
roomCount | Integer | 房间数量 |
deviceCount | Integer | 设备数量 |
tenantId | String | isv租户ID |
topSpaceId | String | 顶层空间ID |
4.9.4. 示例
- 请求示例
```json
{
"request": {
}, "id": "xxx-xxx-xxx-xxx-xxx", "params": {"iotToken": "xxxx", "apiVer": "1.0.4"
}, "version": "1.0" }"houseId":"xxxx"
* 返回示例
```json
{
"code":200,
"data":{
"houseId":"xxx",
"houseName":"xx",
"address":{
"country":"",
"province":"",
"city":"",
"district":"",
"detail":""},
"roomCount":2,
"deviceCount":5,
"tenantId":"isv_tenant_id",
"topSpaceId":"top_space_id"
},
"message":"success"
}
4.10. 修改房屋详情
4.10.1. 定义描述
path | 版本 | 描述 | 是否需要登陆 |
---|---|---|---|
/homelink/house/detail/update | 1.0.0 | 修改指定房屋的信息 | 是 |
4.10.2. 请求参数
参数字段名 | 类型 | 是否必填 | 参数说明 |
---|---|---|---|
houseId | String | 是 | 房屋ID |
houseName | String | 否 | 房屋名称 |
address | json | 否 | 房屋地址 |
4.10.3. 返回参数
无
4.10.4. 示例
- 请求示例
```json
{
"request": {
}, "id": "xxx-xxx-xxx-xxx-xxx", "params": {"iotToken": "xxxx", "apiVer": "1.0.0"
}, "version": "1.0" }"houseId":"xxx", "houseName":"xxx", "address":{ "province":"山东" }
* 返回示例
```json
{
"code":200,
"message":"success"
}
4.11.查询用户房屋信息
4.11.1定义描述
path | 版本 | 描述 | 是否需要用户身份的鉴权 |
---|---|---|---|
/homelink/space/house/list | 1.0.4 | 获取房屋幢单元室信息 | 是 |
4.11.2请求参数
参数 | 类型 | 必填 | 描述 |
---|---|---|---|
topSpaceId | String | 是 | 顶层空间ID |
pageNo | int | 是 | 页码:首页为1 |
pageSize | int | 是 | 页码数据条数 |
4.11.3返回参数
参数 | 类型 | 描述 |
---|---|---|
houseId | String | 房屋ID |
houseName | String | 房屋名称 |
identityId | String | 用户ID |
role | int | 用户在家的角色:MANAGER,MEMBER |
addressBuilding | String | 房屋地址的幢号 |
addressUnit | String | 房屋地址的单元号 |
addressDoor | String | 房屋地址的门牌号 |
4.11.4示例
- 请求示例
```json
{
"request": {
}, "id": "xxx-xxx-xxx-xxx-xxx", "params": {"iotToken": "xxxx", "apiVer": "1.0.4"
}, "version": "1.0" }"topSpaceId":"xxx", "pageNo":1, "pageSize":10
* 返回示例
```json
{
"code": 200,
"data": {
"total":100,
"data":[
{
"houseId":"xxxx",
"houseName":"201幢201单元201室",
"role":1,
"addressBuilding":"1",
"addressUnit":"2",
"addressDoor":"105"
}
]
},
"message":"success"
}
5. 用户管理服务
提供一组与用户相关的服务接口,客户端应用通过本组服务接口可以实现家庭成员的管理等。
注意:apiVer使用最新的版本,当前为1.0.0
5.1. 用户拉取家庭成员列表
返回结果里面包含当前管理员,如果分页的时候前端要专门处理下,比如用户拉去10个用户,可能10个里面有一个是自己。
5.1.1. 定义描述
path | 版本 | 描述 | 是否需要用户身份的鉴权 |
---|---|---|---|
/homelink/member/list | 1.0.3 | 用户拉取家庭成员列表 | 是 |
5.1.2. 请求参数
参数字段名 | 类型 | 必填 | 参数说明 |
---|---|---|---|
houseId | String | 是 | 家ID |
pageNo | Integer | 是 | 从1开始的页序号 |
pageSize | Integer | 是 | 单页的item数量上限. |
5.1.3. 返回值
返回字段名 | 类型 | 描述 |
---|---|---|
total | Integer | 总数量 |
memberDTOList | List< MemberBriefDTO> | 家庭成员列表 |
MemberBriefDTO
字段名 | 类型 | 说明 |
---|---|---|
identityId | String | 用户的身份ID |
memberName | String | 家庭成员的名称 |
role | Integer | 用户在家的角色: 1: 管理员 2: 普通用户 |
5.1.4. 使用示例
- 请求
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.0",
"iotToken": "token"
},
"params": {
"houseId": "houseId1234",
"pageNo": 1,
"pageSize": 20
}
}
- 返回值
{
"code": 200,
"data": {
"total": 2,
"data": [
{
"role": "MANAGER",
"identityId": "5076al2344c628cf6dabb6137a7c3021cb3f4519",
"memberName": "我是东芝an001",
"class": "com.aliyun.iotx.homecenter.open.service.dto.MemberBriefDTO"
},
{
"role": "MEMBER",
"identityId": "508eop390ef57502177dbe786726fc19fa206756",
"memberName": "无名氏",
"class": "com.aliyun.iotx.homecenter.open.service.dto.MemberBriefDTO"
}
],
"pageNo": 1,
"pageSize": 10,
"class": "com.aliyun.iotx.homecenter.service.common.PageDTO"
},
"message": "success",
"localizedMsg": null,
"class": "com.aliyun.iotx.common.base.service.IoTxResult"
}
5.2. 管理员移除指定的家庭成员
5.2.1. 定义描述
path | 版本 | 描述 | 是否需要用户身份的鉴权 |
---|---|---|---|
/homelink/member/remove | 1.0.3 | 管理员移除指定的家庭成员 | 是 |
5.2.2. 参数
参数字段名 | 类型 | 必填 | 参数说明 |
---|---|---|---|
houseId | String | 是 | 家ID |
identityIdList | List< String> | 是 | 要移除的用户的身份ID列表,如果id不存在将不做删除动作 |
5.2.3. 返回值
返回字段名 | 类型 | 描述 |
---|---|---|
code | Integer | 结果码 |
data | Object | 实际数据,此处为null |
message | String | 调用结果 |
localizedMsg | String | 调用结果,中文版 |
5.2.4. 使用示例
- 请求
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.0",
"iotToken": "token"
},
"params": {
"houseId": "houseId1234",
"identityIdList": ["id1","id2"]
}
}
- 返回值
{
"code": 200,
"data": null,
"message": "success",
"localizedMsg": null,
}
5.3. 转让管理员
5.3.1. 定义描述
path | 版本 | 描述 | 是否需要用户身份的鉴权 |
---|---|---|---|
/homelink/member/transfer | 1.0.3 | 转让管理员 | 是 |
5.3.2. 参数
参数字段名 | 类型 | 必填 | 参数说明 |
---|---|---|---|
houseId | String | 是 | 家ID |
newIdentityId | String | 是 | 目标用户的身份ID |
5.3.3. 返回值
返回字段名 | 类型 | 描述 |
---|---|---|
code | Integer | 结果码 |
data | Object | 实际数据,此处为null |
message | String | 调用结果 |
localizedMsg | String | 调用结果,中文版 |
5.3.4. 使用示例
- 请求
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.0",
"iotToken": "token"
},
"params": {
"houseId": "houseId1234",
"newIdentityId": "newid"
}
}
- 返回值
{
"code": 200,
"data": null,
"message": "success",
"localizedMsg": null,
}
5.4. 管理员更新家庭成员
5.4.1. 定义描述
path | 版本 | 描述 | 是否需要用户身份的鉴权 |
---|---|---|---|
/homelink/member/update | 1.0.1 | 管理员更新家庭成员权限 | 是 |
5.4.2. 参数
参数字段名 | 类型 | 必填 | 参数说明 |
---|---|---|---|
memberIdentityId | String | 是 | 要变更的用户身份ID,只能是家庭普通成员 |
houseId | String | 是 | 家ID |
deviceList | List< MemberUpdateRequest> | 是 | 用户对设备操作的列表 |
roomList | List< MemberUpdateRequest> | 是 | 用户对房间操作的列表 |
sceneList | List< MemberUpdateRequest> | 是 | 用户对场景操作的列表 |
MemberUpdateRequest
字段名 | 类型 | 说明 |
---|---|---|
iotId | String | 要更新的设备ID |
sceneId | String | 要更新的场景ID |
roomId | String | 设备或场景所在的房间 |
operation | Integer | 操作,0 删除访问权限, 1 添加访问权限 |
5.4.3. 返回参数
无
5.4.4. 使用示例
- 请求
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.1",
"iotToken": "token"
},
"params": {
"memberIdentityId":"memberIdentityId1",
"houseId": "houseId1234",
"deviceList": [],
"sceneList": [{
"iotId": "iotid1",
"sceneId": "",
"operation": 1,
"roomId": "9ddb8753c18b40afa285b32e89ac3746"
}
],
"roomList": [{
"iotId": "",
"sceneId": "",
"operation": 1,
"roomId": "9ddb8753c18b40afa285b32e89ac3746"
}
]
}
}
- 返回值
{
"code": 200,
"data": null,
"message": "success",
"localizedMsg": null,
}
6. 通用服务
6.1. 获取设备消息列表
查询当前用户的消息记录
6.1.1. 定义描述
path | 版本 | 描述 | 是否需要用户身份的鉴权 |
---|---|---|---|
/message/center/record/query | 1.0.1 | 查询当前用户的消息记录 | 是 |
6.1.2. 请求参数
字段名
|
子键
|
类型
|
是否必填
|
备注
|
requestDTO
|
Map
|
|||
startCreateTime
|
Date
|
N
|
查询开始时间
|
|
endCreateTime
|
Date
|
N
|
查询结束时间
|
|
messageType
|
String
|
Y
|
device:设备
announcement:通知
share:分享
|
|
type
|
String
|
Y
|
MESSAGE: 透传
NOTICE:推送
|
|
maxId
|
Long
|
N
|
查询条件:id <maxId
|
|
minId
|
Long
|
N
|
查询条件: id >minId
|
|
pageNo
|
Integer
|
Y
|
||
pageSize
|
Integer
|
Y
|
最大100
|
|
keyword
|
String
|
N
|
模糊搜索关键字
匹配title或body
|
|
tag
|
Integer
|
N
|
标签,默认值0
|
|
isRead
|
Integer
|
N
|
0:未读
1:已读
|
|
sortType
|
Integer
|
N
|
null or 0: gmtCreate倒排
1: gmtCreate正排
2: id倒排
3: id正排
|
6.1.3. 返回值
字段名
|
子键
|
二级子键
|
三级子键
|
三级子键
|
类型
|
描述
|
data
|
Map
|
|||||
count
|
Long
|
总数
|
||||
data
|
id
|
List<Map>
|
||||
gmtCreate
|
Date
|
创建时间
|
||||
gmtModified
|
Date
|
修改时间
|
||||
appKey
|
Long
|
|||||
title
|
String
|
|||||
body
|
String
|
|||||
messageType
|
String
|
消息类型
设备、共享、通知
|
||||
tag
|
Integer
|
标签
|
||||
isRead
|
Integer
|
阅读状态
|
||||
extData
|
Map
|
附加信息
|
||||
device
|
Map
|
设备信息
|
||||
iotId
|
String
|
设备id
|
||||
productKey
|
String
|
产品key
|
||||
productName
|
String
|
产品名称
|
||||
icon
|
String
|
图标
|
||||
nickName
|
String
|
昵称
|
- 示例结果
{
"code": 200,
"date": {
"count": 1,
"data": [
{
"appKey": 333,
"body": "body3",
"deviceType": "iOS",
"extData": {
"device": {
"icon": "icon1"
}
},
"gmtCreate": 1521695481000,
"gmtModified": 1521695481000,
"id": 3,
"messageId": "m3",
"messageType": "device",
"scopeId": "s3",
"target": "ACCOUNT",
"targetValue": "a3",
"tenantId": "t3",
"title": "title3",
"type": "NOTICE"
}
]
},
"message": "success"
}
6.2. 产生分享二维码
6.2.1. 定义描述
path | 版本 | 描述 | 是否需要用户身份的鉴权 |
---|---|---|---|
/homelink/share/generate/qrcode | 1.0.3 | 产生分享二维码 | 是 |
6.2.2. 请求参数
参数字段名
|
类型
|
是否必须
|
参数说明
|
bizType
|
String
|
是
|
枚举字符串,参考下面bizType接口
|
content
|
String
|
是
|
JSON string
|
bizType对应的content格式
bizType值 | content格式 |
---|---|
"转让家" | {"houseIds":["xxxx"]} //目前只接受一个houseId |
"房屋分享" | {"houseIds":["xxxx"]} |
"房间分享" | {"houseIds":["xxxx"],"roomIds":["xxx"]} |
"设备分享" | {"houseIds":["xxxx"],"deviceIds":["xxx"]} |
"场景分享" | {"houseIds":["xxxx"],"sceneIds":["xxx"]} |
"成员分享" | {"houseIds":["xxxx"],"deviceIds":["xxxx"],"sceneIds":["xxx"]} |
6.2.3. 返回值
参数名 | 类型 | 说明 |
---|---|---|
data | String | 包含二维码和业务码的url |
6.2.4. bizType说明
名称 | 类型 | 含义 |
---|---|---|
HOUSE_SHARE | 分享房屋 | |
ROOM_SHARE | 分享房间 | |
SCENE_SHARE | 分享场景 | |
MEMBER_ADD | 添加成员 | |
DEVICE_SHARE | 设备分享 | |
HOUSE_TRANSFER | 转让家 |
6.2.5. 示例
- 请求示例
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.0",
"iotToken": "token"
},
"params": {
"bizType": "HOUSE_SHARE",
"houseIds":["xxxx"]
}
}
- 返回示例
{
"code":200,
"data":{
"qrCode":"http://homelink.aliyun.com?bizType=HOUSE_DELIVERY&qrCode=xxx",
"content":{
"roomInfo":[{"roomName":"客厅", "deviceCount":5}],
"sceneCount":5
}
},
"message":"success"
}
6.3. 解析二维码
6.3.1. 定义描述
path | 版本 | 描述 | 是否需要用户身份的鉴权 |
---|---|---|---|
/homelink/share/parse/qrCode | 1.0.3 | 客户端扫描二维码时执行的逻辑 | 是 |
6.3.2. 入参
参数名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
qrCode | String | 是 | qrcode,二维码的值 |
6.3.3. 返回值
参数名 | 类型 | 说明 |
---|---|---|
code | Integer | 返回码 |
message | String | 英语提示信息 |
LocalizeMsg | String | 本地化提示信息 |
data | JSON | 二维码代表数据,具体见 返回示例 |
6.3.4. 示例
- 请求示例
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.0",
"iotToken": "token"
},
"params": {
"qrCode":"http://homelink.aliyun.com?bizType=HOUSE_DELIVERY&qrCode=xxx"
}
}
- 返回示例
{
"code":200,
"data":{
"qrCode":"http://homelink.aliyun.com?bizType=HOUSE_DELIVERY&qrCode=xxx",
"content":{
"roomInfo":[{"roomName":"客厅", "deviceCount":5}],
"sceneCount":5
}
},
"message":"success"
}