Skip to content

Commit ed6972d

Browse files
committed
more updates
1 parent df32fac commit ed6972d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,28 @@ This app creates a device identity with ID **myFirstDevice** and a module identi
125125
126126
In this section, you create a Python app on your simulated device that updates the module twin reported properties.
127127
128-
1. **Get your module connection string** -- now if you sign into the [Azure portal](https://portal.azure.com/). Navigate to your IoT Hub and click IoT Devices. Find myFirstDevice, open it and you see myFirstModule was successfully created. Copy the module connection string. It is needed in the next step.
128+
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.
129129
130130
![Azure portal module detail](./media/iot-hub-python-python-module-twin-getstarted/module-detail.png)
131131
132-
2. **Create UpdateModuleTwinReportedProperties app**
132+
2. At your command prompt, run the following command to install the **azure-iot-device** package:
133133
134-
Add the following `using` statements at the top of the **Program.cs** file:
134+
```cmd/sh
135+
pip install azure-iot-device
136+
```
137+
138+
3. Using a text editor, create a file named **UpdateModuleTwinReportedProperties.py** in your working directory.
139+
140+
4. Add the following code to your Python file:
135141
136142
```python
137143
import sys
138144
import iothub_service_client
139145
from iothub_service_client import IoTHubRegistryManager, IoTHubRegistryManagerAuthMethod, IoTHubDeviceTwin, IoTHubError
140146
141147
CONNECTION_STRING = "FILL IN CONNECTION STRING"
142-
DEVICE_ID = "MyFirstDevice"
143-
MODULE_ID = "MyFirstModule"
148+
DEVICE_ID = "myFirstDevice"
149+
MODULE_ID = "myFirstModule"
144150
145151
UPDATE_JSON = "{\"properties\":{\"desired\":{\"telemetryInterval\":122}}}"
146152
@@ -163,11 +169,9 @@ In this section, you create a Python app on your simulated device that updates t
163169
print ( "IoTHubRegistryManager sample stopped" )
164170
```
165171
166-
This code sample shows you how to retrieve the module twin and update reported properties with AMQP protocol.
167-
168172
## Get updates on the device side
169173
170-
In addition to the above code, you can add below code block to get the twin update message on your device.
174+
In addition to the above code, you can use the following code to get the twin update message on your device.
171175
172176
```python
173177
import time

0 commit comments

Comments
 (0)