How to send properties to IoT Central using Python?

randomrabbit 121 Reputation points
2022-05-17T13:59:14.84+00:00

I'm using the Python client for Azure IoT Hub and send messages using send_message() here https://learn.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 Central
Azure IoT Central
An Azure hosted internet of things (IoT) application platform.
352 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,128 questions
0 comments No comments
{count} votes

Accepted answer
  1. Dom 1,556 Reputation points Microsoft Employee
    2022-05-17T14:35:55.837+00:00

    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

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful