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

Device Shadow

Description

On the device list, click a device to open the Device Details page.

Each device has one shadow, which is a JSON file that stores the property value reported by a device and the property value that the IoT platform expects to deliver to the device. Only the latest reported values and expected values are stored in the device shadow.

Application Scenario

  • Query device property status

    • If an NA queries the status of a device when the device is offline, the NA cannot obtain the device status in a timely manner. The device shadow stores the latest device status. Once the device status changes, the device synchronizes its status to its shadow. Using the device shadow, the NA can obtain the device status quickly 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, NAs and devices are decoupled.
  • Modifying device properties: A device administrator modifies device properties through the SP 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 device properties in the device shadow. When the device goes online, the IoT platform synchronizes the new device properties from the device shadow to the device.
    NOTE:
    • This function applies only to devices that support the LWM2M protocol.
    • The property modified in the device shadow can only be one defined in the LWM2M protocol. User-defined device properties cannot be modified.

Query Method

On the Device Shadow tab page, you can view current device properties, including the reported value and desired value. The device administrator can modify properties on the Management Portal or by calling an API.

  • If the reported value is inconsistent with the desired value, it may be that the device is offline and the value is temporarily stored in the device shadow. The desired value is highlighted.
    Figure 1 Inconsistency between the reported value and desired value
  • If the reported value matches the desired value, the latest property value reported by the device matches the desired property value. The desired value is not highlighted.
    Figure 2 Consistency between the reported value and desired value