网关新增子设备请求响应
功能介绍
平台将该网关新增的子设备列表信息通知给网关设备,平台收到网关新增子设备请求后会在30秒内通过此接口返回响应消息。
Topic
下行: $oc/devices/{device_id}/sys/events/down
参数说明
| 字段名 | 必选/可选 | 类型 | 参数描述 |
|---|---|---|---|
| object_device_id | 可选 | String | 对应网关设备id |
| services | 可选 | List<ServiceEvent> | 事件服务列表 |
ServiceEvent定义表
| 字段名 | 必选/可选 | 类型 | 参数描述 |
|---|---|---|---|
| service_id | 必选 | String | $sub_device_manager |
| event_type | 必选 | String | add_sub_device_response |
| event_time | 可选 | String | 事件时间 |
| event_id | 必选 | String | 事件请求Id,通过该参数关联对应的事件请求。 |
| paras | 必选 | Object | 事件参数JSON对象 |
paras参数列表
| 字段名 | 必选/可选 | 类型 | 参数描述 |
|---|---|---|---|
| successful_devices | 必选 | List<DeviceInfo> | 成功新增的子设备列表详情 |
| failed_devices | 必选 | List<Reason> | 新增子设备失败的原因 |
DeviceInfo定义表
| 字段名 | 必选/可选 | 类型 | 参数描述 |
|---|---|---|---|
| parent_device_id | 必选 | String | 父节点设备ID |
| node_id | 必选 | String | 设备标识。 |
| device_id | 必选 | String | 设备ID |
| name | 可选 | String | 设备名称 |
| description | 可选 | String | 设备描述 |
| manufacturer_id | 可选 | String | 厂商ID |
| model | 可选 | String | 设备型号 |
| product_id | 可选 | String | 产品ID |
| fw_version | 可选 | String | 固件版本 |
| sw_version | 可选 | String | 软件版本 |
| status | 可选 | String | 设备在线状态。
|
| extension_info | 可选 | Object | 设备扩展信息。用户可以自定义任何想要的扩展信息 |
Reason定义表
| 字段名 | 必选/可选 | 类型 | 参数描述 |
|---|---|---|---|
| node_id | 必选 | String | 对应请求中指定的设备的node_id |
| product_id | 必选 | String | 对应请求中指定的设备的product_id |
| error_code | 必选 | String | 新增失败错误原因码 |
| error_msg | 必选 | String | 新增失败原因描述 |
示例
Topic: $oc/devices/{device_id}/sys/events/down
数据格式:
{
"object_device_id": "{object_device_id}",
"services": [
{
"service_id": "$sub_device_manager",
"event_type": "add_sub_device_response",
"event_time": "20151212T121212Z",
"event_id": "40cc9ab1-3579-488c-95c6-c18941c99eb4",
"paras": {
"successful_devices": [
{
"device_id": "c6b39067b0325db34663d3ef421a42f6_subdevice11",
"name": "subdevice11",
"node_id": "subdevice11",
"product_id": "c6b39067b0325db34663d3ef421a42f6",
"description": "subdevice11",
"manufacturer_id": "ofo",
"model": "twx2",
"fw_version": null,
"sw_version": null,
"status": "ONLINE",
"extension_info" : null,
"parent_device_id" : null
}
],
"failed_devices": [
{
"node_id": "subdevice12",
"product_id": "c6b39067b0325db34663d3ef421a42f6",
"error_code": "XXX",
"error_msg": "XXXX"
}
]
}
}
]
}
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.