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
@@ -22,7 +22,7 @@ This article shows you how to create:
22
22
***dmpatterns_getstarted_service.py**: a Python console app that calls the direct method in the simulated device app through your IoT hub. It displays the response and updated reported properties.
23
23
24
24
> [!NOTE]
25
-
> See [Azure IoT SDKs](iot-hub-devguide-sdks.md) for more information about the SDK tools available to build both device and back-end apps.
25
+
> For more information about the SDK tools available to build both device and back-end apps, see [Azure IoT SDKs](iot-hub-devguide-sdks.md).
26
26
27
27
## Prerequisites
28
28
@@ -44,11 +44,13 @@ This article shows you how to create:
44
44
45
45
In this section, you:
46
46
47
-
* Create a Python console app that responds to a direct method called by the cloud
47
+
* Create a Python console app that responds to a direct method called by the cloud.
48
48
49
-
* Simulate a device reboot
49
+
* Simulate a device reboot.
50
50
51
-
* Use the reported properties to enable device twin queries to identify devices and when they last rebooted
51
+
* Use the reported properties to enable device twin queries to identify devices and when they last rebooted.
52
+
53
+
In Azure Cloud Shell you used above or any other environment with Python, create the device code.
52
54
53
55
1. At your command prompt, run the following command to install the **azure-iot-device** package:
54
56
@@ -155,6 +157,8 @@ In this section, you:
155
157
156
158
In this section, you create a Python console app that initiates 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.
157
159
160
+
In Azure Cloud Shell or any other environment with Python, create the console code.
161
+
158
162
1. At your command prompt, run the following command to install the **azure-iot-hub** package:
159
163
160
164
```cmd/sh
@@ -241,15 +245,15 @@ In this section, you create a Python console app that initiates a remote reboot
241
245
242
246
## Run the apps
243
247
244
-
You're now ready to run the apps.
248
+
You're now ready to run the device code and the service code that initiates a reboot of the device.
245
249
246
-
1. At the command prompt, run the following command to begin listening for the reboot direct method.
250
+
1. At the command prompt where you created the device, run the following command to begin listening for the reboot direct method.
247
251
248
252
```cmd/sh
249
253
python dmpatterns_getstarted_device.py
250
254
```
251
255
252
-
2. At another command prompt, run the following command to trigger the remote reboot and query for the device twin to find the last reboot time.
256
+
2. At the command prompt where you create the service, run the following command to trigger the remote reboot and query for the device twin to find the last reboot time.
az iot hub device-identity connection-string show --device-id myDeviceId --hub-name {Your IoT Hub name} -o table
26
+
az iot hub device-identity create --device-id myDeviceId --hub-name {Your IoT Hub name} --resource-group {Resource group of the Hub}
27
+
az iot hub device-identity connection-string show --device-id myDeviceId --hub-name {Your IoT Hub name} --resource-group {Resource group of the Hub} -o table
0 commit comments