question

randomrabbit avatar image
0 Votes"
randomrabbit asked dominicbetts answered

How to send properties to IoT Central using Python?

I'm using the Python client for Azure IoT Hub and send messages using send_message() here https://docs.microsoft.com/en-us/python/api/azure-iot-device/azure.iot.device.message?view=azure-python

Everything I put into the messages shows up in IoT Central inside a telemetry JSON array.

How can i determine what I send as properties and what to keep inside the telemetry array?

Thanks in advance.

azure-iot-hubazure-iot-central
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

dominicbetts avatar image
1 Vote"
dominicbetts answered

To send property updates from a device to IoT Hub (or IoT Central), use the device twin.

Properties can be "read-only", which means the device sends property updates to IoT Hub, or "read-write" in which case IoT Hub can also send property updates to the device.

The following Python samples illustrate both of these scenarios:

https://github.com/Azure/azure-iot-sdk-python/blob/main/azure-iot-device/samples/pnp/README.md

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.