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
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Get started with Azure IoT Hub device twins
3
3
titleSuffix: Azure IoT Hub
4
-
description: How to use Azure IoT Hub device twins and the Azure IoT SDKs to create and simulate devices, add tags to device twins, and execute IoT Hub queries.
4
+
description: How to use the Azure IoT SDKs to create device and backend service application code for device twins.
5
5
author: kgremban
6
6
ms.author: kgremban
7
7
manager: lizross
@@ -47,19 +47,18 @@ The following illustration shows device twin organization:
47
47
48
48
It is useful to review the various device twin fields that are available using the Azure portal. To learn how, see [How to view and update devices based on device twin properties](/azure/iot-hub/manage-device-twins).
49
49
50
-
Additionally, the solution back end can query device twins based on all the above data.
51
-
For more information about device twins, see [Understand device twins](iot-hub-devguide-device-twins.md). For more information about querying, see [IoT Hub query language](iot-hub-devguide-query-language.md).
50
+
Additionally, the solution back end can query device twins based on all the above data. For more information about querying, see [IoT Hub query language](iot-hub-devguide-query-language.md).
52
51
53
52
This article shows you how to:
54
53
55
-
*Retrieve a device twin and update reported properties
54
+
*View device twin and update reported properties
56
55
* Update device twin tags
57
56
* Create a device desired property update notificaton callback
58
57
* Use a backend application to update tags and desired properties
59
58
* Query devices from your back-end app using filters on the tags and properties previously created
60
59
61
60
> [!NOTE]
62
-
> This article is meant to complement compilable [Azure IoT SDKs](iot-hub-devguide-sdks.md) samples that are referenced from within this article. You can use SDK tools to build both device and back-end apps.
61
+
> This article is meant to complement [Azure IoT SDKs](iot-hub-devguide-sdks.md) samples that are referenced from within this article. You can use SDK tools to build both device and back-end applications.
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-device-twins-dotnet.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Get started with Azure IoT Hub device twins (.NET)
3
3
titleSuffix: Azure IoT Hub
4
-
description: How to use Azure IoT Hub device twins and the Azure IoT SDKs for .NET to create and simulate devices, add tags to device twins, and execute IoT Hub queries.
4
+
description: How to use the Azure IoT SDK for .NET to create device and backend service application code for device twins.
@@ -162,12 +162,12 @@ To install the **Microsoft.Azure.Devices** NuGet package:
162
162
163
163
### Connect to IoT hub
164
164
165
-
Connect a backend application to a device using [CreateFromConnectionString](/dotnet/api/microsoft.azure.devices.client.deviceclient.createfromconnectionstring?#microsoft-azure-devices-client-deviceclient-createfromconnectionstring(system-string-microsoft-azure-devices-client-transporttype)). As a parameter, supply the IoT Hub service connection string that you created in the Prerequisites section. The backend application connects to the device through IoT Hub.
165
+
Connect a backend application to a device using [CreateFromConnectionString](/dotnet/api/microsoft.azure.devices.client.deviceclient.createfromconnectionstring?#microsoft-azure-devices-client-deviceclient-createfromconnectionstring(system-string-microsoft-azure-devices-client-transporttype)). As a parameter, supply the **IoT Hub service connection string** that you created in the Prerequisites section. The backend application connects to the device through IoT Hub.
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-device-twins-java.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Get started with Azure IoT Hub device twins (Java)
3
3
titleSuffix: Azure IoT Hub
4
-
description: How to use Azure IoT Hub device twins and the Azure IoT SDKs for Java to create and simulate devices, add tags to device twins, and execute IoT Hub queries.
4
+
description: How to use the Azure IoT SDK for Java to create device and backend service application code for device twins.
This unit describes how to use the Java SDK to create device and backend service application code.
16
+
This unit describes how to use the Azure SDK for Java to create device and backend service application code for device twins.
17
17
18
-
[Java SE Development Kit 8](/azure/developer/java/fundamentals/) is required to run SDK code. Make sure you select **Java 8** under **Long-term support** to navigate to downloads for JDK 8.
18
+
[Java SE Development Kit 8](/azure/developer/java/fundamentals/) is required to use the SDK. Make sure you select **Java 8** under **Long-term support** to navigate to downloads for JDK 8.
19
19
20
20
## Create a device application
21
21
@@ -51,7 +51,7 @@ To connect to a device:
51
51
1.Use the `DeviceClient` constructor to add the device primary connection string and protocol.
@@ -156,7 +156,7 @@ The `ServiceClient` [DeviceTwin](/java/api/com.microsoft.azure.sdk.iot.service.d
156
156
To connect to IoT Hub to view and update device twin information:
157
157
158
158
1. Create a [DeviceTwinClientOptions](/java/api/com.microsoft.azure.sdk.iot.service.devicetwin.devicetwinclientoptions?#com-microsoft-azure-sdk-iot-service-devicetwin-devicetwinclientoptions-devicetwinclientoptions()) object. Set any options that are needed for your application. These options are passed to the `DeviceTwin` object.
159
-
1. Use a [DeviceTwin](/java/api/com.microsoft.azure.sdk.iot.service.devicetwin.devicetwin?#com-microsoft-azure-sdk-iot-service-devicetwin-devicetwin-devicetwin(java-lang-string)) constructor to create the connection to IoT hub. The `DeviceTwin` object handles the communication with your IoT hub. As parameters, supply the IoT Hub service connection string that you created in the Prerequisites section and the `DeviceTwinClientOptions` object.
159
+
1. Use a [DeviceTwin](/java/api/com.microsoft.azure.sdk.iot.service.devicetwin.devicetwin?#com-microsoft-azure-sdk-iot-service-devicetwin-devicetwin-devicetwin(java-lang-string)) constructor to create the connection to IoT hub. The `DeviceTwin` object handles the communication with your IoT hub. As parameters, supply the **IoT Hub service connection string** that you created in the Prerequisites section and the `DeviceTwinClientOptions` object.
160
160
1. The [DeviceTwinDevice](/java/api/com.microsoft.azure.sdk.iot.service.devicetwin.devicetwindevice) object represents the device twin with its properties and tags.
161
161
162
162
```java
@@ -167,7 +167,7 @@ import java.io.IOException;
167
167
importjava.util.HashSet;
168
168
importjava.util.Set;
169
169
170
-
publicstaticfinalString iotHubConnectionString ="{IoT Hub service connection string}";
170
+
publicstaticfinalString iotHubConnectionString ="{IoT hub service connection string}";
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-device-twins-node.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Get started with Azure IoT Hub device twins (Node.js)
3
3
titleSuffix: Azure IoT Hub
4
-
description: How to use Azure IoT Hub device twins and the Azure IoT SDKs for Node.js to create and simulate devices, add tags to device twins, and execute IoT Hub queries.
4
+
description: How to use the Azure IoT SDK for Node.js to create device and backend service application code for device twins.
5
5
author: kgremban
6
6
ms.author: kgremban
7
7
ms.service: iot-hub
@@ -11,6 +11,12 @@ ms.date: 07/20/2024
11
11
ms.custom: mqtt, devx-track-js
12
12
---
13
13
14
+
## Overview
15
+
16
+
This unit describes how to use the Azure SDK for Python to create device and backend service application code for device twins.
17
+
18
+
Node.js version 10.0.x or later is required to use the SDK.
19
+
14
20
## Create a device application
15
21
16
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.
@@ -232,12 +238,12 @@ The [Registry](/javascript/api/azure-iothub/registry?#azure-iothub-registry-gett
232
238
233
239
### Connect to IoT hub
234
240
235
-
Use [fromConnectionString](/javascript/api/azure-iothub/registry?#azure-iothub-registry-fromconnectionstring) to connect to IoT hub. As a parameter, supply the IoT Hub service connection string that you created in the Prerequisites section.
241
+
Use [fromConnectionString](/javascript/api/azure-iothub/registry?#azure-iothub-registry-fromconnectionstring) to connect to IoT hub. As a parameter, supply the **IoT hub service connection string** that you created in the Prerequisites section.
236
242
237
243
```javascript
238
244
'use strict';
239
245
var iothub =require('azure-iothub');
240
-
var connectionString ='{iot Hub service connection string}';
246
+
var connectionString ='{Iot Hub service connection string}';
241
247
var registry =iothub.Registry.fromConnectionString(connectionString);
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-device-twins-python.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Get started with Azure IoT Hub device twins (Python)
3
3
titleSuffix: Azure IoT Hub
4
-
description: How to use Azure IoT Hub device twins and the Azure IoT SDKs for Python to create and simulate devices, add tags to device twins, and execute IoT Hub queries.
4
+
description: How to use the Azure IoT SDK for Python to create device and backend service application code for device twins.
This section describes how to use the Python SDK to create device and backend service application code.
16
+
This unit describes how to use the Azure SDK for Python to create device and backend service application code for device twins.
17
17
18
18
[Python version 3.7 or later](https://www.python.org/downloads/) is recommended. Make sure to use the 32-bit or 64-bit installation as required by your setup. When prompted during the installation, make sure to add Python to your platform-specific environment variable.
19
19
@@ -43,7 +43,7 @@ from azure.iot.device.aio import IoTHubDeviceClient
43
43
44
44
# substitute the device connection string in conn_str
@@ -133,7 +133,7 @@ The [IoTHubRegistryManager](/python/api/azure-iot-hub/azure.iot.hub.iothubregist
133
133
134
134
### Connect to IoT hub
135
135
136
-
Connect to IoT hub using [from_connection_string](/python/api/azure-iot-hub/azure.iot.hub.iothubregistrymanager?#azure-iot-hub-iothubregistrymanager-from-connection-string). As a parameter, supply the IoT Hub service connection string that you created in the Prerequisites section.
136
+
Connect to IoT hub using [from_connection_string](/python/api/azure-iot-hub/azure.iot.hub.iothubregistrymanager?#azure-iot-hub-iothubregistrymanager-from-connection-string). As a parameter, supply the **IoT Hub service connection string** that you created in the Prerequisites section.
137
137
138
138
After connecting you can update the device twin.
139
139
@@ -144,7 +144,7 @@ from azure.iot.hub import IoTHubRegistryManager
144
144
from azure.iot.hub.models import Twin, TwinProperties, QuerySpecification, QueryResult
145
145
146
146
# Connect to IoT hub
147
-
IOTHUB_CONNECTION_STRING="[IoT Hub service connection string]"
147
+
IOTHUB_CONNECTION_STRING="{IoT hub service connection string}"
0 commit comments