Release Notes
$shadow/operation/${productId}/${deviceName} is used to publish (upstream) messages, through which GET/UPDATE operations can be implemented on device shadow data.$shadow/operation/result/${productId}/${deviceName} is used to subscribe to (downstream) messages, through which the shadow server sends responses and push messages.
$shadow/operation/${productId}/${deviceName} topic. The SDK provides an API that sends the GET message in a specific JSON string format:{"type": "get","clientToken": "clientToken"}
clientToken is the token used to uniquely identify the session, which is generated by the requester and returned as is by the responder.$shadow/operation/ABC1234567/AirConditioner through the API provided by the SDK to get the latest device parameters.$shadow/operation/result/${productId}/${deviceName} topic to return all data content of the device shadow through the JSON data, and the SDK will notify the business layer through the corresponding callback function.$shadow/operation/result/ABC1234567/AirConditioner . Below is the sample code:{"type": "get","result": 0,"timestamp": 1514967088,"clientToken": "clientToken","payload": {"state": {"reported": {"temperature": 27},"desired": {"temperature": 25},"delta": {"temperature": 25}},"metadata": {"reported": {"temperature": {"timestamp": 1514967066}},"desired": {"temperature": {"timestamp": 1514967076}},"delta": {"temperature": {"timestamp": 1514967076}}},"version": 1,"timestamp": 1514967076}}
desired part in the device shadow document, the device shadow service will automatically generate the corresponding delta part; otherwise, no content will be present in the desired and delta parts.delta messages.$shadow/operation/${productId}/${deviceName} topic. The SDK provides a corresponding API to send UPDATE messages, and the business layer only needs to specify the content of the reported field. The message content is in a specific JSON string format.$shadow/operation/ABC1234567/AirConditioner to report its current device status. Below is the sample code:{"type": "update","state": {"reported": {"temperature": 27}},"version": 1,"clientToken": "clientToken"}
{"type": "update","result": 0,"timestamp": 1514967066,"clientToken": "clientToken","payload": {"state": {"reported": {"temperature": 27}},"metadata": {"reported": {"temperature": {"timestamp": 1514967066}}},"version": 2,"timestamp": 1514967066}}
$shadow/operation/result/ABC1234567/AirConditioner :{"type": "update","result": 5005,"timestamp": 1514967066,"clientToken": "clientToken","payload": {"state": {"reported": {"temperature": 27,"mode": "cool"}},"metadata": {"reported": {"temperature": {"timestamp": 1514967066},"mode": {"timestamp": 1514967050}}},"version": 2,"timestamp": 1514967066}}
desired field through the HTTP RESTful API.{"type": "update","state": {"desired": {"temperature": 25}},"version": 2,"clientToken": "clientToken"}
{"type": "update","result": 0,"timestamp": 1514967076,"clientToken": "clientToken","payload": {"state": {"desired": {"temperature": 25}},"metadata": {"desired": {"temperature": {"timestamp": 1514967076}}},"version": 3,"timestamp": 1514967076}}
delta message to $shadow/operation/result/ABC1234567/AirConditioner.{"type": "delta","timestamp": 1514967076,"payload": {"state": {"temperature": 25},"metadata": {"temperature": {"timestamp": 1514967076}},"version": 3,"timestamp": 1514967076}}
delta Message by Devicedelta message, the business layer can empty the content of the desired field and send it to the device shadow server by sending the message to the $shadow/operation/${productId}/${deviceName} topic, indicating that the device has responded to this delta message.$shadow/operation/ABC1234567/AirConditioner :{"type": "update","state": {"desired": null},"version": 3,"clientToken": "clientToken"}
desired field to prevent repeated sending due to the differences between the parameter value in the reported field and that in the desired field.$shadow/operation/result/${productId}/${deviceName} ."desired":null message from the air conditioner, the shadow server will send a device shadow update success message to $shadow/operation/result/ABC1234567/AirConditioner .{"type": "update","result": 0,"timestamp": 1514967086,"clientToken": "clientToken","payload": {"state": {"reported": {"temperature": 25},"desired": null},"metadata": {"reported": {"temperature": {"timestamp": 1514967086}},"desired": {"temperature": {"timestamp": 1514967086}}},"version": 4,"timestamp": 1514967086}}
result field) will clearly tell the SDK that the update failed and the reason is that the version is too low. In addition, the server will also send the latest content in the payload to the device.Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback