Skip to content

Commit 91ef12a

Browse files
committed
Updates
1 parent 73e20e3 commit 91ef12a

File tree

5 files changed

+30
-25
lines changed

5 files changed

+30
-25
lines changed

articles/iot-hub/how-to-device-twins.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Get started with Azure IoT Hub device twins
33
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.
55
author: kgremban
66
ms.author: kgremban
77
manager: lizross
@@ -47,19 +47,18 @@ The following illustration shows device twin organization:
4747

4848
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).
4949

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).
5251

5352
This article shows you how to:
5453

55-
* Retrieve a device twin and update reported properties
54+
* View device twin and update reported properties
5655
* Update device twin tags
5756
* Create a device desired property update notificaton callback
5857
* Use a backend application to update tags and desired properties
5958
* Query devices from your back-end app using filters on the tags and properties previously created
6059

6160
> [!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.
6362
6463
## Prerequisites
6564

includes/iot-hub-howto-device-twins-dotnet.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Get started with Azure IoT Hub device twins (.NET)
33
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.
55
author: kgremban
66
ms.author: kgremban
77
ms.service: iot-hub
@@ -13,9 +13,9 @@ ms.custom: mqtt, devx-track-csharp, devx-track-dotnet
1313

1414
## Overview
1515

16-
This section describes how to use the .NET/C# SDK to create device and backend service application code.
16+
This unit describes how to use the Azure SDK for .NET to create device and backend service application code for device twins.
1717

18-
Visual Studio is required to use the .NET/C# SDK.
18+
Visual Studio is required to use the SDK.
1919

2020
## Create a device application
2121

@@ -52,7 +52,7 @@ using Microsoft.Azure.Devices.Client;
5252
using Microsoft.Azure.Devices.Shared;
5353
using Newtonsoft.Json;
5454

55-
static string DeviceConnectionString = "{Device connection string}";
55+
static string DeviceConnectionString = "{IoT Hub device connection string}";
5656
static _deviceClient = null;
5757
_deviceClient = DeviceClient.CreateFromConnectionString(DeviceConnectionString,
5858
TransportType.Mqtt);
@@ -162,12 +162,12 @@ To install the **Microsoft.Azure.Devices** NuGet package:
162162

163163
### Connect to IoT hub
164164

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.
166166

167167
```csharp
168168
using Microsoft.Azure.Devices;
169169
static RegistryManager registryManager;
170-
static string connectionString = "{service connection string}";
170+
static string connectionString = "{IoT hub service connection string}";
171171
registryManager = RegistryManager.CreateFromConnectionString(connectionString);
172172
```
173173

includes/iot-hub-howto-device-twins-java.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Get started with Azure IoT Hub device twins (Java)
33
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.
55
author: kgremban
66
ms.author: kgremban
77
ms.service: iot-hub
@@ -13,9 +13,9 @@ ms.custom: mqtt, devx-track-java, devx-track-extended-java
1313

1414
## Overview
1515

16-
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.
1717

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.
1919

2020
## Create a device application
2121

@@ -51,7 +51,7 @@ To connect to a device:
5151
1. Use the `DeviceClient` constructor to add the device primary connection string and protocol.
5252

5353
```java
54-
String connString = "{device connection string}";
54+
String connString = "{IoT hub device connection string}";
5555
DeviceClient client = new DeviceClient(connString, protocol);
5656
```
5757

@@ -156,7 +156,7 @@ The `ServiceClient` [DeviceTwin](/java/api/com.microsoft.azure.sdk.iot.service.d
156156
To connect to IoT Hub to view and update device twin information:
157157

158158
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.
160160
1. The [DeviceTwinDevice](/java/api/com.microsoft.azure.sdk.iot.service.devicetwin.devicetwindevice) object represents the device twin with its properties and tags.
161161

162162
```java
@@ -167,7 +167,7 @@ import java.io.IOException;
167167
import java.util.HashSet;
168168
import java.util.Set;
169169

170-
public static final String iotHubConnectionString = "{IoT Hub service connection string}";
170+
public static final String iotHubConnectionString = "{IoT hub service connection string}";
171171
public static final String deviceId = "myDeviceId";
172172
public static final String region = "US";
173173
public static final String plant = "Redmond43";

includes/iot-hub-howto-device-twins-node.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Get started with Azure IoT Hub device twins (Node.js)
33
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.
55
author: kgremban
66
ms.author: kgremban
77
ms.service: iot-hub
@@ -11,6 +11,12 @@ ms.date: 07/20/2024
1111
ms.custom: mqtt, devx-track-js
1212
---
1313

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+
1420
## Create a device application
1521

1622
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
232238
233239
### Connect to IoT hub
234240
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.
236242
237243
```javascript
238244
'use strict';
239245
var iothub = require('azure-iothub');
240-
var connectionString = '{iot Hub service connection string}';
246+
var connectionString = '{Iot Hub service connection string}';
241247
var registry = iothub.Registry.fromConnectionString(connectionString);
242248
```
243249

includes/iot-hub-howto-device-twins-python.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Get started with Azure IoT Hub device twins (Python)
33
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.
55
author: kgremban
66
ms.author: kgremban
77
ms.service: iot-hub
@@ -13,7 +13,7 @@ ms.custom: mqtt, devx-track-python, py-fresh-zinc
1313

1414
## Overview
1515

16-
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.
1717

1818
[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.
1919

@@ -43,7 +43,7 @@ from azure.iot.device.aio import IoTHubDeviceClient
4343

4444
# substitute the device connection string in conn_str
4545
# and add it to the IoTHubDeviceClient object
46-
conn_str = "IOTHUB_DEVICE_CONNECTION_STRING"
46+
conn_str = "{IOT hub device connection string}"
4747
device_client = IoTHubDeviceClient.create_from_connection_string(conn_str)
4848

4949
# connect the application to the device
@@ -133,7 +133,7 @@ The [IoTHubRegistryManager](/python/api/azure-iot-hub/azure.iot.hub.iothubregist
133133

134134
### Connect to IoT hub
135135

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.
137137

138138
After connecting you can update the device twin.
139139

@@ -144,7 +144,7 @@ from azure.iot.hub import IoTHubRegistryManager
144144
from azure.iot.hub.models import Twin, TwinProperties, QuerySpecification, QueryResult
145145

146146
# Connect to IoT hub
147-
IOTHUB_CONNECTION_STRING = "[IoT Hub service connection string]"
147+
IOTHUB_CONNECTION_STRING = "{IoT hub service connection string}"
148148
iothub_registry_manager = IoTHubRegistryManager.from_connection_string(IOTHUB_CONNECTION_STRING)
149149
```
150150

0 commit comments

Comments
 (0)