Feature Overview
Devices of the gateway type can perform online and offline operations for their subdevices through data communication with the cloud. The topics used by this functionality match those for gateway subdevice topology management:
Data upstream Topic (for publishing):
$gateway/operation/${productid}/${devicename}Data downstream Topic (for subscription):
$gateway/operation/result/${productid}/${devicename}Proxy Sub-Device Online
Devices of the gateway type can use the data upstream Topic to proxy subdevices to go live. After the request is successful, the cloud returns the subdevice online result information through the data downstream Topic.
Request data format for gateway proxying sub-device online
{"type": "online","payload": {"devices": [{"product_id": "CFC******AG7","device_name": "subdeviceaaaa"}]}}
Response data format for proxying sub-device online
{"type": "online","payload": {"devices": [{"product_id": "CFC******AG7","device_name": "subdeviceaaaa","result":0}]}}
Request parameter description:
Field | Type | Description |
type | String | Gateway message type. The value for agent sub-device online is: online. |
payload.devices | Array | List of sub-devices to be online. |
product_id | String | Subdevice Product ID. |
device_name | String | Subdevice name. |
Response Parameter Description:
Field | Type | Description |
type | String | Gateway message type. The value for agent sub-device online is: online. |
payload.devices | Array | List of sub-devices to be online. |
product_id | String | Subdevice Product ID. |
device_name | String | Subdevice name. |
result | Int |
Agent Subdevice Offline
Devices of the gateway type can use the data upstream Topic to proxy subdevices to go offline. After the request is successful, the cloud returns the offline information of the successful subdevice through the data downstream Topic.
Request data format for gateway proxying sub-device offline
{"type": "offline","payload": {"devices": [{"product_id": "CFC******AG7","device_name": "subdeviceaaaa"}]}}
Response data format for gateway proxying sub-device offline
{"type": "offline","payload": {"devices": [{"product_id": "CFC******AG7","device_name": "subdeviceaaaa","result":-1}]}}
Request parameter description:
Field | Type | Description |
type | String | Gateway Message Type. The value for agent sub-device offline is: offline. |
payload.devices | Array | List of sub-devices to be offline via agent. |
product_id | String | Subdevice Product ID. |
device_name | String | Subdevice name. |
Response Parameter Description:
Field | Type | Description |
type | String | Gateway Message Type. The value for agent sub-device offline is: offline. |
payload.devices | Array | List of sub-devices to be offline via agent. |
product_id | String | Subdevice Product ID. |
device_name | String | Subdevice name. |
result | Int | Subdevice Offline Result. Specific Error Codes are in the table below. |
Error Code
Error Code | Description |
0 | Succeeded. |
-1 | Gateway device not bound to subdevice. |
-2 | System error. Subdevice online or offline failure. |
801 | Request parameter error. |
802 | Invalid device name, or device does not exist. |
810 | Unsupported subdevice. |