Updated on 2023-11-24 GMT+08:00

End Devices and Device Twins

End Device

End devices can be as small as a sensor or controller or as large as a smart camera or computer numerical control (CNC) machine tool.

These devices can be connected to IEF through edge nodes by using MQTT. After end devices are connected to IEF, you can manage them on IEF in a unified manner.

Figure 1 End device management

Device Twins

An end device usually has two types of data:

  • Metadata that does not change, which includes the serial number, asset identifier, MAC address, and other information about the device. This type of data can be called static properties or device properties.
  • Dynamic device data, which includes dedicated real-time device data for a specific scenario, for example, the on and off states of a light. This type of data can be called twin properties.

DeviceTwin has the same features as physical devices and facilitates better communication between end devices and applications. The commands sent by an application reach DeviceTwin (an internal component on an edge node). Then, DeviceTwin updates the device status according to Expected State set by the application. In addition, the end device reports its Actual State in real time. DeviceTwin records both Actual State and Expected State of the end device. In this way, the status of an offline device can be synchronized when it comes back online.

Figure 2 DeviceTwin

On the IEF console, you can register an end device and bind it to an edge node. After the binding, the device and twin properties will be stored on the edge node. Applications deployed on the edge node can obtain device and twin properties, and modify Expected State and Actual State recorded in DeviceTwin. In addition, IEF synchronizes twin properties between the cloud and edge. If a conflict occurs, the properties at the edge are used.

For details about the edge-cloud synergy for the end device status, see Device Twin Working Principles.

Procedure

To enable IEF to manage and control an end device, perform the following steps:

  1. Define a device template (including device and twin properties).
  2. Use the template to register a device.

    You can also register a device without using a template.

  3. Bind the device to an edge node.
  4. Perform related operations, such as monitoring the device status.