IoT Central device development overview
This article applies to device developers.
An IoT Central application lets you monitor and manage millions of devices throughout their life cycle. This overview is intended for device developers who implement code to run on devices that connect to IoT Central.
Devices interact with an IoT Central application using the following primitives:
- Telemetry is data that a device sends to IoT Central. For example, a stream of temperature values from an onboard sensor.
- Properties are state values that a device reports to IoT Central. For example, the current firmware version of the device. You can also have writable properties that IoT Central can update on the device such as a target temperature.
- Commands are called from IoT Central to control the behavior a device. For example, your IoT Central application might call a command to reboot a device.
A solution builder is responsible for configuring dashboards and views in the IoT Central web UI to visualize telemetry, manage properties, and call commands.
Types of device
The following sections describe the main types of device you can connect to an IoT Central application:
A standalone device connects directly to IoT Central. A standalone device typically sends telemetry from its onboard or connected sensors to your IoT Central application. Standalone devices can also report property values, receive writable property values, and respond to commands.
A gateway device manages one or more downstream devices that connect to your IoT Central application. You use IoT Central to configure the relationships between the downstream devices and the gateway device. To learn more, see Define a new IoT gateway device type in your Azure IoT Central application.
An edge device connects directly to IoT Central, but acts as an intermediary for other devices known as leaf devices. An edge device is typically located close to the leaf devices for which it's acting as an intermediary. Scenarios that use edge devices include:
- Enable devices that can't connect directly to IoT Central to connect through the edge device. For example, a leaf device might use bluetooth to connect to the edge device, which then connects over the internet to IoT Central.
- Aggregate telemetry before it's sent to IoT Central. This approach can help to reduce the costs of sending data to IoT Central.
- Control leaf devices locally to avoid the latency associated with connecting to IoT Central over the internet.
An edge device can also send its own telemetry, report its properties, and respond to writable property updates and commands.
IoT Central only sees the edge device, not the leaf devices connected to the edge device.
To learn more, see Add an Azure IoT Edge device to your Azure IoT Central application.
Connect a device
Azure IoT Central uses the Azure IoT Hub Device Provisioning service (DPS) to manage all device registration and connection.
Using DPS enables:
- IoT Central to support onboarding and connecting devices at scale.
- You to generate device credentials and configure the devices offline without registering the devices through IoT Central UI.
- You to use your own device IDs to register devices in IoT Central. Using your own device IDs simplifies integration with existing back-office systems.
- A single, consistent way to connect devices to IoT Central.
To learn more, see Get connected to Azure IoT Central.
Communication protocols that a device can use to connect to IoT Central include MQTT, AMQP, and HTTPS. Internally, IoT Central uses an IoT hub to enable device connectivity. For more information about the communication protocols that IoT Hub supports for device connectivity, see Choose a communication protocol.
Implement the device
An IoT Central device template includes a model that specifies the behaviors a device of that type should implement. Behaviors include telemetry, properties, and commands.
You can export the model from IoT Central as a Digital Twins Definition Language (DTDL) v2 JSON file.
Each model has a unique device twin model identifier (DTMI), such as
dtmi:com:example:Thermostat;1. When a device connects to IoT Central, it sends the DTMI of the model it implements. IoT Central can then associate the correct device template with the device.
IoT Plug and Play defines a set of conventions that a device should follow when it implements a DTDL model.
The Azure IoT device SDKs include support for the IoT Plug and Play conventions.
A device model is defined using the DTDL. This language lets you define:
- The telemetry the device sends. The definition includes the name and data type of the telemetry. For example, a device sends temperature telemetry as a double.
- The properties the device reports to IoT Central. A property definition includes its name and data type. For example, a device reports the state of a valve as a Boolean.
- The properties the device can receive from IoT Central. Optionally, you can mark a property as writable. For example, IoT Central sends a target temperature as a double to a device.
- The commands a device responds to. The definition includes the name of the command, and the names and data types of any parameters. For example, a device responds to a reboot command that specifies how many seconds to wait before rebooting.
A DTDL model can be a no-component or a multi-component model:
- No-component model: A simple model doesn't use embedded or cascaded components. All the telemetry, properties, and commands are defined a single default component. For an example, see the Thermostat model.
- Multi-component model. A more complex model that includes two or more components. These components include a single default component, and one or more additional nested components. For an example, see the Temperature Controller model.
To learn more, see IoT Plug and Play components in models
A device should follow the IoT Plug and Play conventions when it exchanges data with IoT Central. The conventions include:
- Send the DTMI when it connects to IoT Central.
- Send correctly formatted JSON payloads and metadata to IoT Central.
- Correctly respond to writable properties and commands from IoT Central.
- Follow the naming conventions for component commands.
Currently, IoT Central does not fully support the DTDL Array and Geospatial data types.
To learn more about the format of the JSON messages that a device exchanges with IoT Central, see Telemetry, property, and command payloads.
To learn more about the IoT Plug and Play conventions, see IoT Plug and Play conventions.
Use one of the Azure IoT device SDKs to implement the behavior of your device. The code should:
- Register the device with DPS and use the information from DPS to connect to the internal IoT hub in your IoT Central application.
- Announce the DTMI of the model the device implements.
- Send telemetry in the format that the device model specifies. IoT Central uses the model in the device template to determine how to use the telemetry for visualizations and analysis.
- Synchronize property values between the device and IoT Central. The model specifies the property names and data types so that IoT Central can display the information.
- Implement command handlers for the commands specified in the model. The model specifies the command names and parameters that the device should use.
For more information about the role of device templates, see What are device templates?.
For some sample code, see Create and connect a client application.
Languages and SDKs
For more information about the supported languages and SDKs, see Understand and use Azure IoT Hub device SDKs.
If you're a device developer and want to dive into some code, the suggested next step is to Create and connect a client application to your Azure IoT Central application.
If you want to learn more about using IoT Central, the suggested next steps are to try the quickstarts, beginning with Create an Azure IoT Central application.