You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot-hub/how-to-device-twins.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ This article shows you how to:
54
54
55
55
* Retrieve a device twin and update reported properties
56
56
* Update device twin tags
57
-
* Create a device desired property update notificaiton callback
57
+
* Create a device desired property update notificaton callback
58
58
* Use a backend application to update tags and desired properties
59
59
* Query devices from your back-end app using filters on the tags and properties previously created
60
60
@@ -71,7 +71,7 @@ This article shows you how to:
71
71
72
72
* IoT Hub service connection string
73
73
74
-
In this article, you create a back-end service that adds desired properties to a device twin and then queries the identity registry to find all devices with reported properties that have been updated accordingly. Your service needs the **service connect** permission to modify desired properties of a device twin, and it needs the **registry read** permission to query the identity registry. There is no default shared access policy that contains only these two permissions, so you need to create one.
74
+
In this article you create a back-end service that adds desired properties to a device twin and then queries the identity registry to find all devices with reported properties that have been updated accordingly. Your service needs the **service connect** permission to modify desired properties of a device twin, and it needs the **registry read** permission to query the identity registry. There is no default shared access policy that contains only these two permissions, so you need to create one.
75
75
76
76
To create a shared access policy that grants **service connect** and **registry read** permissions and get a connection string for this policy, follow these steps:
Device applications can read and write twin reported properties, and be notified of desired twin property changes that have been set by a backend application or IoT Hub.
16
+
Device applications can read and write twin reported properties, and be notified of desired twin property changes that are set by a backend application or IoT Hub.
17
17
18
18
This section describes how to use device application code to:
19
19
@@ -23,7 +23,7 @@ This section describes how to use device application code to:
23
23
24
24
### Add device NuGet Package
25
25
26
-
Device client applications requre the **Microsoft.Azure.Devices.Client** NuGet package.
26
+
Device client applications require the **Microsoft.Azure.Devices.Client** NuGet package.
27
27
28
28
To install the **Microsoft.Azure.Devices.Client** NuGet package:
29
29
@@ -94,13 +94,13 @@ catch (Exception ex)
94
94
95
95
You can create a desired property update callback handler that executes when the desired property is changed in the device by passing the callback handler method name to [SetDesiredPropertyUpdateCallbackAsync](/dotnet/api/microsoft.azure.devices.client.deviceclient.setdesiredpropertyupdatecallbackasync?#microsoft-azure-devices-client-deviceclient-setdesiredpropertyupdatecallbackasync(microsoft-azure-devices-client-desiredpropertyupdatecallback-system-object)).
96
96
97
-
For example, this call will set up the system to notify a method named`OnDesiredPropertyChangedAsync` whenever a desired property is changed.
97
+
For example, this call sets up the system to notify a method named`OnDesiredPropertyChangedAsync` whenever a desired property is changed.
The twin properties are passed to the callback method as a [TwinCollection](/dotnet/api/microsoft.azure.devices.shared.twincollection?view=azure-dotnet&branch=main) and can be examined as `KeyValuePair` structures.
103
+
The twin properties are passed to the callback method as a [TwinCollection](/dotnet/api/microsoft.azure.devices.shared.twincollection) and can be examined as `KeyValuePair` structures.
104
104
105
105
This example receives the desired property updates as a `TwinCollection`, then loops through and prints the `KeyValuePair` collection updates. After looping through the `KeyValuePair` collection, the code calls `UpdateReportedPropertiesAsync` to update the `DateTimeLastDesiredPropertyChangeReceived` reported property to keep the last updated time up to date.
106
106
@@ -143,7 +143,7 @@ This section describes how to create backend application code to:
143
143
144
144
### Add service NuGet Package
145
145
146
-
Backend service applications requre the **Microsoft.Azure.Devices** NuGet package.
146
+
Backend service applications require the **Microsoft.Azure.Devices** NuGet package.
147
147
148
148
To install the **Microsoft.Azure.Devices** NuGet package:
You can retrieve current device twin fields into a into a [Twin](/dotnet/api/microsoft.azure.devices.shared.twin) object by calling [GetTwinAsync](/dotnet/api/microsoft.azure.devices.registrymanager.gettwinasync?#microsoft-azure-devices-registrymanager-gettwinasync(system-string-system-string)).
167
+
You can retrieve current device twin fields into a [Twin](/dotnet/api/microsoft.azure.devices.shared.twin) object by calling [GetTwinAsync](/dotnet/api/microsoft.azure.devices.registrymanager.gettwinasync?#microsoft-azure-devices-registrymanager-gettwinasync(system-string-system-string)).
168
168
169
169
The `Twin` class includes [properties](/dotnet/api/microsoft.azure.devices.shared.twin?&#properties) that correspond to each section of a device twin. Use the `Twin` class properties to view and update device twin fields. You can use the `Twin` object properties to update multiple twin fields before writing the updates to the device using `UpdateTwinAsync`.
170
170
@@ -209,7 +209,7 @@ catch (Exception e)
209
209
210
210
##### Write using a JSON string
211
211
212
-
You can also create and apply a device twin information update patch that contains a block of field updates, including different field types such as tags mixed with desired properties. IoT Hub will parse and apply the patch if it is correctly formatted and the fields are updatable. For example, device twin reported properties cannot be updated by a backend application and the patch for these fields will not be applied.
212
+
You can also create and apply a device twin information update patch that contains a block of field updates, including different field types such as tags mixed with desired properties. IoT Hub parses and applies the patch if it is correctly formatted and the fields are updatable. For example, device twin reported properties cannot be updated by a backend application and the patch for these fields are not be applied.
213
213
214
214
This example calls `GetTwinAsync` to retrieve the current device twin fields into a `Twin` object, creates a JSON-formatted `tag` patch with region and plant location information, then calls `UpdateTwinAsync` to apply the patch to update the device twin. An error message is displayed if `UpdateTwinAsync` failed.
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-device-twins-python.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ This section describes how to use the Python SDK to create device and backend se
21
21
22
22
Device applications can read and write twin reported properties, and be notified of desired twin property changes that have been set by a backend application or IoT Hub.
23
23
24
-
The [IoTHubDeviceClient](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient) class contains methods that can be use to work with device twins.
24
+
The [IoTHubDeviceClient](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient) class contains methods that can be used to work with device twins.
25
25
26
26
This section describes how to create device application code that:
27
27
@@ -52,7 +52,7 @@ await device_client.connect()
52
52
53
53
### Retrieve a device twin and examine reported properties
54
54
55
-
You can retrieve and examine device twin information including tags and properties. The device twin information retrieved matches device twin schema that you can view for a device in the Auzre portal.
55
+
You can retrieve and examine device twin information including tags and properties. The device twin information retrieved matches device twin schema that you can view for a device in the Azure portal.
56
56
57
57
Call [get_twin](/python/api/azure-iot-device/azure.iot.device.iothubdeviceclient?#azure-iot-device-iothubdeviceclient-get-twin) to get the device twin from the Azure IoT Hub service. The twin information is placed into a variable that can be printed or examined. This is a synchronous call, meaning that this function does not return until the twin is retrieved from the service.
58
58
@@ -158,7 +158,7 @@ You can update device twin tags and desired properties from a backend applicatio
158
158
* properties are stored in a [TwinProperties](/en-us/python/api/azure-iot-hub/azure.iot.hub.protocol.models.twinproperties) object
159
159
1. Call [update_twin](/python/api/azure-iot-hub/azure.iot.hub.iothubregistrymanager?#azure-iot-hub-iothubregistrymanager-update-twin) to apply the patch to the device twin. You can also use [replace_twin](/python/api/azure-iot-hub/azure.iot.hub.iothubregistrymanager?#azure-iot-hub-iothubregistrymanager-replace-twin) to replace desired properties and tags for a device twin.
160
160
161
-
This example updates `region` and `plant` tag information. and sets a `power_level` desired property to `1`.
161
+
This example updates `region` and `plant` tag information, and sets a `power_level` desired property to `1`.
0 commit comments