How to Manage Control Instructions for Offline Devices through Device Shadow

Updating the Running Parameters of Offline IoT-enabled Devices Through Device Shadow

1) Technical Solution for Updating the Running Parameters of Devices

In many IoT service scenarios, we need to dynamically adjust the running parameter settings of devices on the cloud. Many IoT-enabled devices fail to stay online round-the-clock, frequently go online and offline, and enter the scheduled sleep mode and stay offline due to unstable network connectivity and limited battery capacity. In this context, we need to figure out how to send control instructions from the cloud to offline devices and enable the devices to run service logic based on new instructions when they are online.

IoT Platform provides the device shadow feature to update the parameter settings of offline devices.

2) Device-side Development

To use the device shadow feature, it is mandatory to implement the following configurations.

  • Subscribe to the update topic (live update) of device shadow.
  • Pull device shadow upon startup to ensure that the device obtains the latest shadow data after going online.

3) Configuration Update on the Cloud

The service systems store the latest parameter settings desired for device shadow by calling the UpdateDeviceShadow operation of device shadow. The following code runs to implement the same.

4) Running Results

4.1 Update Parameter Settings Through an API on the Cloud

Log on to the console to view information about device shadow after a successful API call by service systems. Refer to the following snapshot for details.

4.2 Obtain Live Updates on Online Devices

Online devices obtain parameter settings from the cloud through the subscribed topic of device shadow.

4.3 Obtain Updates After Devices Go Online

Cloud-based parameter settings are cached in device shadow when devices are offline. After the devices go online, they pull the latest parameter settings from the cloud. The parameter update time is earlier than the current time. Devices determine whether to apply the latest parameter settings based on the update time.

Original Source:

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.