|
1 | 1 | ---
|
2 |
| -title: Telemetry, property, and command payloads in Azure IoT Central | Microsoft Docs |
3 |
| -description: Azure IoT Central device templates let you specify the telemetry, properties, and commands of a device must implement. Understand the format of the data a device can exchange with IoT Central. |
| 2 | +title: Device message payloads in Azure IoT Central |
| 3 | +description: Device templates specify the telemetry, properties, and commands a device uses. Understand the format of the data a device can exchange with IoT Central. |
4 | 4 | author: dominicbetts
|
5 | 5 | ms.author: dobett
|
6 |
| -ms.date: 06/08/2022 |
| 6 | +ms.date: 05/24/2023 |
7 | 7 | ms.topic: conceptual
|
8 | 8 | ms.service: iot-central
|
9 | 9 | services: iot-central
|
@@ -34,6 +34,9 @@ Each example shows a snippet from the device model that defines the type and exa
|
34 | 34 |
|
35 | 35 | The JSON file that defines the device model uses the [Digital Twin Definition Language (DTDL) V2](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/DTDL.v2.md).
|
36 | 36 |
|
| 37 | +> [!TIP] |
| 38 | +> To troubleshoot device payload issues, see [Unmodeled data issues](troubleshoot-connection.md#unmodeled-data-issues) or use the **Raw data** view of the device in your IoT Central application. |
| 39 | +
|
37 | 40 | For sample device code that shows some of these payloads in use, see the [Create and connect a client application to your Azure IoT Central application](tutorial-connect-device.md) tutorial.
|
38 | 41 |
|
39 | 42 | ## View raw data
|
@@ -74,11 +77,84 @@ To learn more about message properties, see [System Properties of device-to-clou
|
74 | 77 |
|
75 | 78 | ### Telemetry in components
|
76 | 79 |
|
77 |
| -If the telemetry is defined in a component, add a custom message property called `$.sub` with the name of the component as defined in the device model. To learn more, see [Tutorial: Create and connect a client application to your Azure IoT Central application](tutorial-connect-device.md). |
| 80 | +If the telemetry is defined in a component, add a custom message property called `$.sub` with the name of the component as defined in the device model. To learn more, see [Tutorial: Create and connect a client application to your Azure IoT Central application](tutorial-connect-device.md). This tutorial shows how to use different programming languages to send telemetry from a component. |
78 | 81 |
|
79 | 82 | > [!IMPORTANT]
|
80 | 83 | > To display telemetry from components hosted in IoT Edge modules correctly, use [IoT Edge version 1.2.4](https://github.com/Azure/azure-iotedge/releases/tag/1.2.4) or later. If you use an earlier version, telemetry from your components in IoT Edge modules displays as *_unmodeleddata*.
|
81 | 84 |
|
| 85 | +### Telemetry in inherited interfaces |
| 86 | + |
| 87 | +If the telemetry is defined in an inherited interface, your device sends the telemetry as if it is defined in the root interface. Given the following device model: |
| 88 | + |
| 89 | +```json |
| 90 | +[ |
| 91 | + { |
| 92 | + "@id": "dtmi:contoso:device;1", |
| 93 | + "@type": "Interface", |
| 94 | + "contents": [ |
| 95 | + { |
| 96 | + "@type": [ |
| 97 | + "Property", |
| 98 | + "Cloud", |
| 99 | + "StringValue" |
| 100 | + ], |
| 101 | + "displayName": { |
| 102 | + "en": "Device Name" |
| 103 | + }, |
| 104 | + "name": "DeviceName", |
| 105 | + "schema": "string" |
| 106 | + } |
| 107 | + ], |
| 108 | + "displayName": { |
| 109 | + "en": "Contoso Device" |
| 110 | + }, |
| 111 | + "extends": [ |
| 112 | + "dtmi:contoso:sensor;1" |
| 113 | + ], |
| 114 | + "@context": [ |
| 115 | + "dtmi:iotcentral:context;2", |
| 116 | + "dtmi:dtdl:context;2" |
| 117 | + ] |
| 118 | + }, |
| 119 | + { |
| 120 | + "@context": [ |
| 121 | + "dtmi:iotcentral:context;2", |
| 122 | + "dtmi:dtdl:context;2" |
| 123 | + ], |
| 124 | + "@id": "dtmi:contoso:sensor;1", |
| 125 | + "@type": [ |
| 126 | + "Interface", |
| 127 | + "NamedInterface" |
| 128 | + ], |
| 129 | + "contents": [ |
| 130 | + { |
| 131 | + "@type": [ |
| 132 | + "Telemetry", |
| 133 | + "NumberValue" |
| 134 | + ], |
| 135 | + "displayName": { |
| 136 | + "en": "Meter Voltage" |
| 137 | + }, |
| 138 | + "name": "MeterVoltage", |
| 139 | + "schema": "double" |
| 140 | + } |
| 141 | + ], |
| 142 | + "displayName": { |
| 143 | + "en": "Contoso Sensor" |
| 144 | + }, |
| 145 | + "name": "ContosoSensor" |
| 146 | + } |
| 147 | +] |
| 148 | +``` |
| 149 | + |
| 150 | +The device sends meter voltage telemetry using the following payload. The device doesn't include the interface name in the payload: |
| 151 | + |
| 152 | +```json |
| 153 | +{ |
| 154 | + "MeterVoltage": 5.07 |
| 155 | +} |
| 156 | +``` |
| 157 | + |
82 | 158 | ### Primitive types
|
83 | 159 |
|
84 | 160 | This section shows examples of primitive telemetry types that a device streams to an IoT Central application.
|
|
0 commit comments