$gateway/operation/${productid}/${devicename}
$gateway/operation/result/${productid}/${devicename}
{"type": "bind","payload": {"devices": [{"product_id": "CFCS****G7","device_name": "****ev","signature": "signature","random": 121213,"timestamp": 1589786839,"signmethod": "hmacsha256","authtype": "psk"}]}}
Parameter | Type | Description |
type | String | Gateway message type. For subdevice binding, the value is bind |
payload.devices | Array | List of subdevices to be bound |
product_id | String | Subdevice product ID |
device_name | String | Subdevice name |
signature | String | Signature string for subdevice binding. Signature algorithm: 1. Concatenate the product ID, device name, random number, and timestamp into the string to sign: text=${product_id}${device_name};${random};${expiration_time} 2. Use the PSK of the device or the SHA1 digest of the certificate to sign: sign = hmac_sha1(device_secret, text) |
random | Int | Random number |
timestamp | Int | Timestamp in seconds |
signmethod | String | Signature algorithm. hmacsha1 and hmacsha256 are supported |
authtype | String | Signature type. psk: uses device PSK to sign certificate: uses device public key certificate to sign |
{"type": "bind","payload": {"devices": [{"product_id": "CFCS****G7","device_name": "****ev","result": -1}]}}
Parameter | Type | Description |
type | String | Gateway message type. For subdevice binding, the value is bind |
payload.devices | Array | List of subdevices to be bound |
product_id | String | Subdevice product ID |
device_name | String | Subdevice name |
result | Int | Subdevice binding result. For specific error codes, please see the table below |
{"type": "unbind","payload": {"devices": [{"product_id": "CFCS****G7","device_name": "****ev"}]}}
Parameter | Type | Description |
type | String | Gateway message type. For subdevice unbinding, the value is unbind |
payload.devices | Array | List of subdevices to be unbound |
product_id | String | Subdevice product ID |
device_name | String | Subdevice name |
{"type": "bind","payload": {"devices": [{"product_id": "CFCS****G7","device_name": "****ev","result": -1}]}}
Parameter | Type | Description |
type | String | Gateway message type. For subdevice unbinding, the value is unbind |
payload.devices | Array | List of subdevices to be unbound |
product_id | String | Subdevice product ID |
device_name | String | Subdevice name |
result | Int | Subdevice binding result. For more information, please see Error codes |
$gateway/operation/${productid}/${devicename}
Data downstream topic: $gateway/operation/result/${productid}/${devicename}
{"type": "describe_sub_devices"}
Parameter | Type | Description |
type | String | Gateway message type. For subdevice query, the value is describe_sub_devices |
{"type": "describe_sub_devices","payload": {"devices": [{"product_id": "XKFA****LX","device_name": "2OGDy7Ws8mG****YUe"},{"product_id": "XKFA****LX","device_name": "5gcEHg3Yuvm****2p8"},{"product_id": "XKFA****LX","device_name": "hmIjq0gEFcf****F5X"},{"product_id": "XKFA****LX","device_name": "x9pVpmdRmET****mkM"},{"product_id": "XKFA****LX","device_name": "zmHv6o6n4G3****Bgh"}]}}
Parameter | Type | Description |
type | String | Gateway message type. For subdevice query, the value is describe_sub_devices |
payload.devices | Array | List of subdevices bound to the gateway |
product_id | String | Subdevice product ID |
device_name | String | Subdevice name |
$gateway/operation/result/${productid}/${devicename}
{"type": "change","payload": {"status": 0, // 0: unbound, 1: bound"devices": [{"product_id": "CFCS****G7","device_name": "****ev",}]}}
Parameter | Type | Description |
type | String | Gateway message type. For topological relationship change, the value is change |
status | Int | Topological relationship change status. 0: unbound 1: bound |
payload.devices | Array | List of subdevices bound to the gateway |
product_id | String | Subdevice product ID |
device_name | String | Subdevice name |
{"type": "change","result": 0}
Parameter | Type | Description |
type | String | Gateway message type. For topological relationship change, the value is change |
result | Int | Gateway response processing result |
Error Code | Description |
0 | Success |
-1 | The gateway device is not bound to the subdevice |
-2 | System error. Subdevice connection or disconnection failed |
801 | Request parameter error |
802 | The device name is invalid, or the device does not exist |
803 | Signature verification failed |
804 | The signature algorithm is not supported |
805 | The signature request has expired |
806 | This device has already been bound |
807 | Non-general devices cannot be bound |
808 | Forbidden operation |
809 | Duplicate binding |
810 | Unsupported subdevice |