Updated on 2022-02-24 GMT+08:00

Device Shadow

The device shadow is a JSON file that stores the property values reported by a device and the property values that the IoT platform expects to deliver to the device. Only the latest reported values and expected values are stored on the device shadow. Each device has only one shadow. You can query and modify the device shadow, obtain the latest device property values, and deliver the expected values to devices through the Management Portal or by calling APIs.

The device shadow applies only to LWM2M devices in the following scenarios:

  • Querying device status

    • If an NA queries the status of a device when the device is offline, the NA will not be able to obtain the device status in a timely manner. The device shadow stores the latest device status. Once the device status changes, the device synchronizes the device status to the device shadow. Using the device shadow, the NA can obtain the device status in time regardless of whether the device is online.

    • Many NAs frequently query the device status. Due to the limited processing capability of the device, frequent queries adversely affect device performance. The device shadow enables the device to actively synchronize its status. The NAs request the device status from the device shadow. In this way, the NAs and the devices are decoupled.
  • Modifying device property values: A device administrator modifies device property values through the management portal or by calling an API. If the modified configuration cannot be delivered to the device in a timely manner because the device is offline, the IoT platform stores the modified values in the device shadow. After the device comes back online, the IoT platform synchronizes the new device property values from the device shadow to the device.