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-management.md
+2-18Lines changed: 2 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,11 +24,11 @@ The device is responsible for:
24
24
25
25
* Initiating the corresponding device-specific action on the device.
26
26
27
-
* Providing status updates through *reported properties* to IoT Hub.
27
+
* Providing status updates through reported properties to IoT Hub.
28
28
29
29
The back-end app can run device twin queries to report on the progress of the device management actions.
30
30
31
-
This article shows you how a back-end app and a device app can work together to initiate and monitor a remote device reboot using IoT Hub:
31
+
This article shows you how a back-end app and a device app can work together to initiate and monitor a remote device action using direct methods and device twins. For this article, we use a device reboot as an example:
32
32
33
33
* A service app calls a direct method to reboot in a device app through an IoT hub. The service app then displays the response and updated reported properties.
34
34
* A device app handles a direct method to reboot a device and updates the last reboot time.
@@ -47,23 +47,7 @@ This article shows you how a back-end app and a device app can work together to
47
47
* If your application uses the MQTT protocol, make sure that **port 8883** is open in your firewall. The MQTT protocol communicates over port 8883. This port may be blocked in some corporate and educational network environments. For more information and ways to work around this issue, see [Connecting to IoT Hub (MQTT)](../iot/iot-mqtt-connect-to-iot-hub.md#connecting-to-iot-hub).
48
48
49
49
* Language SDK requirements:
50
-
***.NET SDK** - Requires Visual Studio.
51
-
***Python SDK** - [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.
52
50
53
-
* Device applications require the **azure-iot-device** package. You can install the package using this command:
54
-
55
-
```cmd/sh
56
-
pip install azure-iot-device
57
-
```
58
-
59
-
* Service applications require the **azure-iot-hub** package. You can install the package using this command:
60
-
61
-
```cmd/sh
62
-
pip install azure-iot-hub
63
-
```
64
-
65
-
* **Java** - Requires [Java SE Development Kit 8](/azure/developer/java/fundamentals/). Make sure you select **Java 8** under **Long-term support** to navigate to downloads for JDK 8.
66
-
* **Node.js** - Requires Node.js version 10.0.x or later.
This article describes how to use the [Azure IoT SDK for .NET](https://github.com/Azure/azure-iot-sdk-csharp) to create device and backend service application code for device direct messages.
@@ -85,7 +87,7 @@ catch (Exception ex)
85
87
}
86
88
```
87
89
88
-
In this example, the `onReboot` callback method implements the direct method on the device. This code updates reported properties related to a simulated device reboot. The reported properties can be read and verified by an IoT Hub or backend application, as demonstrated in the **Create a backend application** section of this article.
90
+
In this example, the `onReboot` callback method implements the direct method on the device. This code updates reported properties related to a device reboot. The reported properties can be read and verified by a IoT Hub or backend application, as demonstrated in the [Create a backend application](#create-a-backend-application) section of this article.
*[Simulated Device with Command](https://github.com/Azure/azure-iot-sdk-csharp/tree/main/iothub/device/samples/getting%20started/SimulatedDeviceWithCommand)
@@ -133,9 +135,9 @@ The Azure IoT SDK for .NET provides working samples of device apps that handle d
133
135
134
136
## Create a backend application
135
137
136
-
This section describes how to initiate a remote reboot on a device using a direct method. The app uses device twin queries to discover the last reboot time for that device.
138
+
This section describes how to trigger a direct method on a device and then use device twin queries to monitor the status of that device.
137
139
138
-
The [ServiceClient](/dotnet/api/microsoft.azure.devices.serviceclient) class exposes all methods required to create a backend application to send messages to devices.
140
+
The [ServiceClient](/dotnet/api/microsoft.azure.devices.serviceclient) class exposes all methods required to create a backend application to send direct method calls to devices.
139
141
140
142
### Required service NuGet package
141
143
@@ -152,7 +154,7 @@ Add the following `using` statements.
152
154
153
155
### Connect to IoT hub
154
156
155
-
Connect a backend application to a device using [CreateFromConnectionString](/dotnet/api/microsoft.azure.devices.serviceclient.createfromconnectionstring?#microsoft-azure-devices-serviceclient-createfromconnectionstring(system-string-microsoft-azure-devices-serviceclientoptions)).
157
+
Connect a backend application using [CreateFromConnectionString](/dotnet/api/microsoft.azure.devices.serviceclient.createfromconnectionstring?#microsoft-azure-devices-serviceclient-createfromconnectionstring(system-string-microsoft-azure-devices-serviceclientoptions)).
156
158
157
159
To invoke a direct method on a device through IoT Hub, your service needs the **service connect** permission. By default, every IoT Hub is created with a shared access policy named **service** that grants this permission.
158
160
@@ -174,7 +176,7 @@ To invoke a method on a device:
174
176
1. Create a [CloudToDeviceMethod](/dotnet/api/microsoft.azure.devices.cloudtodevicemethod) object. Pass the device direct method name as a parameter.
175
177
1. Call [InvokeDeviceMethodAsync](/dotnet/api/microsoft.azure.devices.serviceclient.invokedevicemethodasync?#microsoft-azure-devices-serviceclient-invokedevicemethodasync(system-string-microsoft-azure-devices-cloudtodevicemethod-system-threading-cancellationtoken)) to invoke the method on the device.
176
178
177
-
This example calls the "reboot" method to initiate a reboot on the device. The "reboot" method is mapped to a listener on the device as described in the **Create a direct method callback** section of this article.
179
+
This example calls the "reboot" method to initiate a reboot on the device. The "reboot" method is mapped to a listener on the device as described in the [Create a direct method callback](#create-a-direct-method-callback) section of this article.
***Java** - Requires [Java SE Development Kit 8](/azure/developer/java/fundamentals/). Make sure you select **Java 8** under **Long-term support** to navigate to downloads for JDK 8.
15
+
14
16
## Overview
15
17
16
18
This article describes how to use the [Azure IoT SDK for Java](https://github.com/Azure/azure-iot-sdk-java) to create device and backend service application code for device direct methods.
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-device-management-node.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ ms.date: 10/09/2024
11
11
ms.custom: mqtt, devx-track-js
12
12
---
13
13
14
+
***Node.js** - Requires Node.js version 10.0.x or later.
15
+
14
16
## Overview
15
17
16
18
This article describes how to use the [Azure IoT SDK for Node.js](https://github.com/Azure/azure-iot-sdk-node) to create device and backend service application code for device direct methods.
Copy file name to clipboardExpand all lines: includes/iot-hub-howto-device-management-python.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,20 @@ ms.date: 10/09/2024
11
11
ms.custom: mqtt, devx-track-python, py-fresh-zinc
12
12
---
13
13
14
+
***Python SDK** - [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.
15
+
16
+
* Device applications require the **azure-iot-device** package. You can install the package using this command:
17
+
18
+
```cmd/sh
19
+
pip install azure-iot-device
20
+
```
21
+
22
+
* Service applications require the **azure-iot-hub** package. You can install the package using this command:
23
+
24
+
```cmd/sh
25
+
pip install azure-iot-hub
26
+
```
27
+
14
28
## Overview
15
29
16
30
This article describes how to use the [Azure IoT SDK for Python](https://github.com/Azure/azure-iot-sdk-python) to create device and backend service application code for device direct methods.
0 commit comments