Skip to content

Commit 6a07ace

Browse files
committed
added run and output
1 parent e38083f commit 6a07ace

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

articles/iot-hub/iot-hub-python-python-module-twin-getstarted.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ ms.author: menchi
2020
2121
At the end of this tutorial, you have three Python apps:
2222

23-
* **CreateIdentities**, which creates a device identity, a module identity and associated security key to connect your device and module clients.
23+
* **CreateModule**, which creates a device identity, a module identity, and associated security keys to connect your device and module clients.
2424

2525
* **UpdateModuleTwinDesiredProperties**, which sends updated module twin desired properties to your IoT Hub.
2626

27-
* **
27+
* **ReceiveModuleTwinDesiredPropertiesPatch**, which receives the module twin desired properties patch on your device.
2828

2929
[!INCLUDE [iot-hub-include-python-sdk-note](../../includes/iot-hub-include-python-sdk-note.md)]
3030

@@ -114,7 +114,7 @@ In this section, you create a Python app that creates a device identity and a mo
114114
1. At your command prompt, run the following command:
115115
116116
```cmd/sh
117-
python AddModule.py
117+
python CreateModule.py
118118
```
119119
120120
This app creates a device identity with ID **myFirstDevice** and a module identity with ID **myFirstModule** under device **myFirstDevice**. (If that module ID already exists in the identity registry, the code simply retrieves the existing module information.) The app then displays the primary key for that identity. You use this key in the simulated module app to connect to your IoT hub.
@@ -173,7 +173,7 @@ In this section, you create a Python app that updates the module twin desired pr
173173
174174
## Get updates on the device side
175175
176-
You can use the following code to get the module twin update patch on your device.
176+
In this section, you create a Python app to get the module twin desired properties update on your device.
177177
178178
1. Get your module connection string. In [Azure portal](https://portal.azure.com/), navigate to your IoT Hub and select **IoT devices** on the left pane. Select **myFirstDevice** from the list of devices and open it. Under **Module identities** select **myFirstModule**. Copy the module connection string. You need it in a following step.
179179
@@ -226,6 +226,32 @@ You can use the following code to get the module twin update patch on your devic
226226
iothub_client_sample_run()
227227
```
228228
229+
## Run the apps
230+
231+
In this section you run the **ReceiveModuleTwinDesiredPropertiesPatch** app on your device and then run the **UpdateModuleTwinDesiredProperties** app to update the desired properties of your module.
232+
233+
1. Open a command window and run the device app:
234+
235+
```cmd/sh
236+
python ReceiveModuleTwinDesiredPropertiesPatch.py
237+
```
238+
239+
![Device app initial output](./media/iot-hub-python-python-module-twin-getstarted/device-1.png)
240+
241+
1. In a separate command window, run the service app:
242+
243+
```cmd/sh
244+
python UpdateModuleTwinDesiredProperties.py
245+
```
246+
247+
Notice that the **TelemetryInterval** desired property appears in the updated module twin in your service app output:
248+
249+
![Service app output](./media/iot-hub-python-python-module-twin-getstarted/service.png)
250+
251+
And the receipt of the same property appears in the desired properties patch in the output of your device app:
252+
253+
![Device app output shows desired properties patch](./media/iot-hub-python-python-module-twin-getstarted/device-2.png)
254+
229255
## Next steps
230256
231257
To continue getting started with IoT Hub and to explore other IoT scenarios, see:
8.94 KB
Loading
11.7 KB
Loading
31.6 KB
Loading

0 commit comments

Comments
 (0)