Skip to content

Commit fffafcf

Browse files
committed
UUF fix - clarify solution back end concept
1 parent dcbe706 commit fffafcf

File tree

3 files changed

+169
-159
lines changed

3 files changed

+169
-159
lines changed

articles/iot-hub/iot-hub-devguide-device-twins.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: kgremban
77
ms.author: kgremban
88
ms.service: azure-iot-hub
99
ms.topic: concept-article
10-
ms.date: 02/22/2024
10+
ms.date: 12/17/2024
1111
ms.custom: [mqtt, 'Role: Cloud Development']
1212
---
1313

@@ -20,15 +20,15 @@ ms.custom: [mqtt, 'Role: Cloud Development']
2020
This article describes:
2121

2222
* The structure of the device twin: *tags*, *desired properties*, and *reported properties*.
23-
* The operations that device and back-end applications can perform on device twins.
23+
* The operations that [*device applications*](../iot/iot-glossary.md#device-app) and the [*solution back end*](../iot/iot-glossary.md#solution-back-end) can perform on device twins.
2424

2525
Use device twins to:
2626

2727
* Store device-specific metadata in the cloud. For example, the location of a vending machine.
2828

2929
* Report current state information such as available capabilities and conditions from your device app. For example, whether a device is connected to your IoT hub over cellular or WiFi.
3030

31-
* Synchronize the state of long-running workflows between device app and back-end app. For example, when the solution back end specifies the new firmware version to install, and the device app reports the various stages of the update process.
31+
* Synchronize the state of long-running workflows between device app and back-end apps. For example, when a back-end app specifies the new firmware version to install, and the device app reports the various stages of the update process.
3232

3333
* Query your device metadata, configuration, or state.
3434

@@ -42,21 +42,21 @@ To learn how device twins relate to the device model used by an Azure IoT Plug a
4242

4343
Device twins store device-related information that:
4444

45-
* Device and back ends can use to synchronize device conditions and configuration.
45+
* Device apps and back-end apps can use to synchronize device conditions and configuration.
4646

4747
* The solution back end can use to query and target long-running operations.
4848

4949
The lifecycle of a device twin is linked to its corresponding [device identity](iot-hub-devguide-identity-registry.md). Device twins are implicitly created and deleted when a device identity is created or deleted in IoT Hub.
5050

5151
A device twin is a JSON document that includes:
5252

53-
* **Tags**. A section of the JSON document that the solution back end can read from and write to. Tags aren't visible to device apps.
53+
* **Tags**. A section of the JSON document that back-end apps can read from and write to. Tags aren't visible to device apps.
5454

55-
* **Desired properties**. Used along with reported properties to synchronize device configuration or conditions. The solution back end can set desired properties, and the device app can read them. The device app can also receive notifications of changes in the desired properties.
55+
* **Desired properties**. Used along with reported properties to synchronize device configuration or conditions. Back-end apps can set desired properties, and the device app can read them. The device app can also receive notifications of changes in the desired properties.
5656

57-
* **Reported properties**. Used along with desired properties to synchronize device configuration or conditions. The device app can set reported properties, and the solution back end can read and query them.
57+
* **Reported properties**. Used along with desired properties to synchronize device configuration or conditions. The device app can set reported properties, and back-end apps can read and query them.
5858

59-
* **Device identity properties**. The root of the device twin JSON document contains the read-only properties from the corresponding device identity stored in the [identity registry](iot-hub-devguide-identity-registry.md). Properties `connectionStateUpdatedTime` and `generationId` won't be included.
59+
* **Device identity properties**. The root of the device twin JSON document contains the read-only properties from the corresponding device identity stored in the [identity registry](iot-hub-devguide-identity-registry.md). The `connectionStateUpdatedTime` and `generationId` properties aren't included.
6060

6161
![Diagram that shows which applications interact with which device twin properties.](./media/iot-hub-devguide-device-twins/twin.png)
6262

@@ -109,16 +109,16 @@ The root object contains the device identity properties, and container objects f
109109

110110
### Reported property example
111111

112-
In the previous example, the device twin contains a `batteryLevel` property that is reported by the device app. This property makes it possible to query and operate on devices based on the last reported battery level. Other examples include the device app reporting device capabilities or connectivity options.
112+
In the previous example, the device twin contains a `batteryLevel` reported property. This property makes it possible to query and operate on devices based on the last reported battery level. Other examples include the device app reporting device capabilities or connectivity options.
113113

114114
> [!NOTE]
115-
> Reported properties simplify scenarios where the solution back end is interested in the last known value of a property. Use [device-to-cloud messages](iot-hub-devguide-messages-d2c.md) if the solution back end needs to process device telemetry in the form of sequences of timestamped events, such as time series.
115+
> Reported properties simplify scenarios where you're interested in the last known value of a property. Use [device-to-cloud messages](iot-hub-devguide-messages-d2c.md) if you want to process device telemetry in the form of sequences of timestamped events, such as time series.
116116
117117
### Desired property example
118118

119119
In the previous example, the `telemetryConfig` device twin desired and reported properties are used by the solution back end and the device app to synchronize the telemetry configuration for this device. For example:
120120

121-
1. The solution back end sets the desired property with the desired configuration value. Here's the portion of the document with the desired property set:
121+
1. A back-end app sets the desired property with the desired configuration value. Here's the portion of the document with the desired property set:
122122

123123
```json
124124
"desired": {
@@ -141,7 +141,7 @@ In the previous example, the `telemetryConfig` device twin desired and reported
141141
}
142142
```
143143

144-
3. The solution back end tracks the results of the configuration operation across many devices by [querying](iot-hub-devguide-query-language.md) device twins.
144+
3. A back-end app tracks the results of the configuration operation across many devices by [querying](iot-hub-devguide-query-language.md) device twins.
145145

146146
> [!NOTE]
147147
> The preceding snippets are examples, optimized for readability, of one way to encode a device configuration and its status. IoT Hub does not impose a specific schema for the device twin desired and reported properties in the device twins.
@@ -157,7 +157,7 @@ The solution back end operates on the device twin using the following atomic ope
157157

158158
* **Retrieve device twin by ID**. This operation returns the device twin document, including tags and desired and reported system properties.
159159

160-
* **Partially update device twin**. This operation enables the solution back end to partially update the tags or desired properties in a device twin. The partial update is expressed as a JSON document that adds or updates any property. Properties set to `null` are removed. The following example creates a new desired property with value `{"newProperty": "newValue"}`, overwrites the existing value of `existingProperty` with `"otherNewValue"`, and removes `otherOldProperty`. No other changes are made to existing desired properties or tags:
160+
* **Partially update device twin**. This operation partially updates the tags or desired properties in a device twin. The partial update is expressed as a JSON document that adds or updates any property. Properties set to `null` are removed. The following example creates a new desired property with value `{"newProperty": "newValue"}`, overwrites the existing value of `existingProperty` with `"otherNewValue"`, and removes `otherOldProperty`. No other changes are made to existing desired properties or tags:
161161

162162
```json
163163
{
@@ -173,11 +173,11 @@ The solution back end operates on the device twin using the following atomic ope
173173
}
174174
```
175175

176-
* **Replace desired properties**. This operation enables the solution back end to completely overwrite all existing desired properties and substitute a new JSON document for `properties/desired`.
176+
* **Replace desired properties**. This operation completely overwrites all existing desired properties and substitutes a new JSON document for `properties/desired`.
177177

178-
* **Replace tags**. This operation enables the solution back end to completely overwrite all existing tags and substitute a new JSON document for `tags`.
178+
* **Replace tags**. This operation completely overwrites all existing tags and substitutes a new JSON document for `tags`.
179179

180-
* **Receive twin notifications**. This operation allows the solution back end to be notified when the twin is modified. To do so, your IoT solution needs to create a route and to set the Data Source equal to *twinChangeEvents*. By default, no such route exists, so no twin notifications are sent. If the rate of change is too high, or for other reasons such as internal failures, the IoT Hub might send only one notification that contains all changes. Therefore, if your application needs reliable auditing and logging of all intermediate states, you should use device-to-cloud messages. To learn more about the properties and body returned in the twin notification message, see [Nontelemetry event schemas](iot-hub-non-telemetry-event-schema.md).
180+
* **Receive twin notifications**. This operation notifies when the twin is modified. To receive device twin change notifications, your IoT solution needs to create a route and to set the Data Source equal to *twinChangeEvents*. By default, no such route exists, so no twin notifications are sent. If the rate of change is too high, or for other reasons such as internal failures, the IoT Hub might send only one notification that contains all changes. Therefore, if your application needs reliable auditing and logging of all intermediate states, you should use device-to-cloud messages. To learn more about the properties and body returned in the twin notification message, see [Nontelemetry event schemas](iot-hub-non-telemetry-event-schema.md).
181181

182182
All the preceding operations support [Optimistic concurrency](iot-hub-devguide-device-twins.md#optimistic-concurrency) and require the **ServiceConnect** permission, as defined in [Control access to IoT Hub](iot-hub-dev-guide-sas.md).
183183

@@ -193,9 +193,9 @@ The device app operates on the device twin using the following atomic operations
193193

194194
* **Retrieve device twin**. This operation returns the device twin document (including desired and reported system properties) for the currently connected device. (Tags aren't visible to device apps.)
195195

196-
* **Partially update reported properties**. This operation enables the partial update of the reported properties of the currently connected device. This operation uses the same JSON update format that the solution back end uses for a partial update of desired properties.
196+
* **Partially update reported properties**. This operation enables the partial update of the reported properties of the currently connected device.
197197

198-
* **Observe desired properties**. The currently connected device can choose to be notified of updates to the desired properties when they happen. The device receives the same form of update (partial or full replacement) executed by the solution back end.
198+
* **Observe desired properties**. The currently connected device can choose to be notified of updates to the desired properties when they happen.
199199

200200
All the preceding operations require the **DeviceConnect** permission, as defined in [Control Access to IoT Hub](iot-hub-dev-guide-sas.md).
201201

@@ -254,7 +254,7 @@ IoT Hub enforces an 8-KB size limit on the value of `tags`, and a 32-KB size lim
254254

255255
Twin size is computed as follows:
256256

257-
* For each property in the JSON document, IoT Hub cumulatively computes and adds the length of the property's key and value.
257+
* IoT Hub cumulatively computes and adds the length of each property's key and value.
258258

259259
* Property keys are considered as UTF8-encoded strings.
260260

@@ -327,7 +327,7 @@ Tags, desired properties, and reported properties all support optimistic concurr
327327

328328
Device twins have an ETag property `etag`, as per [RFC7232](https://tools.ietf.org/html/rfc7232), that represents the twin's JSON representation. You can use the `etag` property in conditional update operations from the solution back end to ensure consistency. This property is the only option for ensuring consistency in operations that involve the `tags` container.
329329

330-
Device twin desired and reported properties also have a `$version` value that is guaranteed to be incremental. Similarly to an ETag, the version can be used by the updating party to enforce consistency of updates. For example, a device app for a reported property or the solution back end for a desired property.
330+
Device twin desired and reported properties also have a `$version` value that is guaranteed to be incremental. Similarly to an ETag, you can use the version property to enforce consistency of updates. For example, a device app for a reported property or a back-end app for a desired property.
331331

332332
Versions are also useful when an observing agent (such as the device app observing the desired properties) must reconcile races between the result of a retrieve operation and an update notification. The [Device reconnection flow section](#device-reconnection-flow) provides more information.
333333

0 commit comments

Comments
 (0)