azure-iot-hubazure-iot-central

Azure device template vs device twin


Azure IoT Serivce has a Device Template and a Device Twin. How are those two connected - I haven't found an article that clarifies that yet. What is the difference, how are they related? I assume the following: the device twin is derived from the properties,... of the device template. Where can I find the raw device twin data in IoT Central?


Solution

  • You're correct that they're related - here's a summary:

    The Device Template defines the capabilities of a device that connects to IoT Central - the capabilities include the telemetry the device sends, the properties that represent the device state, and the commands that the device can respond to. IoT Central uses the device template to define a UI for the device letting you plot telemetry, manage properties, and call commands.

    The Device Twin is an abstraction that lets you work with device properties both on the device and in the cloud. Conceptually, a Device Twin is a JSON representation of the device properties (state) that's synced between the device and the cloud. Some properties are read-only which means only the device can modify them. Some properties are read/write which means both the device and the cloud can modify them. A device twin is a useful abastraction for device and cloud developers writing code that interacts with device properties.

    The part of the device template that defines the device properties, in effect defines the structure of the device twin that's shared between the device and IoT Central. In IoT Central, you can define views that let you see the device properties, and forms that let you manage read/write device properties. Because IoT Central has GUI tools that you can customize to work with device properties, the device twin concept is less important when you're working with IoT Central.

    You can view the raw data that IoT Central receives from a device on the "Raw data" tab for a device:

    Rw data tab