Skip to content

Commit 35ca410

Browse files
authored
Merge pull request #194261 from rido-min/rido/pnpconvention
Describe ACK messages
2 parents bdabe54 + 8101051 commit 35ca410

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

articles/iot-develop/concepts-convention.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ title: IoT Plug and Play conventions | Microsoft Docs
33
description: Description of the conventions IoT Plug and Play expects devices to use when they send telemetry and properties, and handle commands and property updates.
44
author: rido-min
55
ms.author: rmpablos
6-
ms.date: 07/10/2020
6+
ms.date: 04/06/2022
77
ms.topic: conceptual
88
ms.service: iot-develop
99
services: iot-develop
1010
---
1111

1212
# IoT Plug and Play conventions
1313

14-
IoT Plug and Play devices should follow a set of conventions when they exchange messages with an IoT hub. IoT Plug and Play devices use the MQTT protocol to communicate with IoT Hub.
14+
IoT Plug and Play devices should follow a set of conventions when they exchange messages with an IoT hub. IoT Plug and Play devices use the MQTT protocol to communicate with IoT Hub, AMQP is supported by IoT Hub and available in some device SDKs.
1515

1616
Devices can include [modules](../iot-hub/iot-hub-devguide-module-twins.md), or be implemented in an [IoT Edge module](../iot-edge/about-iot-edge.md) hosted by the IoT Edge runtime.
1717

@@ -129,16 +129,29 @@ The device or module should confirm that it received the property by sending a r
129129
- `av` - an acknowledgment version that refers to the `$version` of the desired property. You can find this value in the desired property JSON payload.
130130
- `ad` - an optional acknowledgment description.
131131

132+
### Acknowledgment responses
133+
134+
When reporting writable properties the device should compose the acknowledgment message, using the four fields described above, to indicate the actual device state, as described in this table
135+
136+
137+
|Status(ac)|Version(av)|Value(value)|Description(av)|
138+
|:---|:---|:---|:---|
139+
|200|Desired version|Desired value|Desired property value accepted|
140+
|202|Desired version|Value accepted by the device|Desired property value accepted, update in progress (should finish with 200)|
141+
|203|0|Value set by the device|Property set from the device, not reflecting any desired|
142+
|400|Desired version|Actual value used by the device|Desired property value not accepted|
143+
|500|Desired version|Actual value used by the device|Exception when applying the property|
144+
132145
When a device starts up, it should request the device twin, and check for any writable property updates. If the version of a writable property increased while the device was offline, the device should send a reported property response to confirm that it received the update.
133146

134-
When a device starts up for the first time, it can send an initial value for a reported property if it doesn't receive an initial desired property from the hub. In this case, the device should set `av` to `1`. For example:
147+
When a device starts up for the first time, it can send an initial value for a reported property if it doesn't receive an initial desired property from the hub. In this case, the device can send the default value with `av` to `0` and `ac` to `203`. For example:
135148

136149
```json
137150
"reported": {
138151
"targetTemperature": {
139152
"value": 20.0,
140-
"ac": 200,
141-
"av": 1,
153+
"ac": 203,
154+
"av": 0,
142155
"ad": "initialize"
143156
}
144157
}
@@ -164,7 +177,7 @@ When the device reaches the target temperature it sends the following message:
164177
"targetTemperature": {
165178
"value": 20.0,
166179
"ac": 200,
167-
"av": 3,
180+
"av": 4,
168181
"ad": "Reached target temperature"
169182
}
170183
}

0 commit comments

Comments
 (0)