Share via

Python send complex data (i.e GPS location) to Azure IoT Central

Vicky Tran 1 Reputation point
2022-02-17T10:29:19.397+00:00

Hi,

I am new to Azure and Python.

I am trying to send data from Raspberry Pi to Azure IoT Central. I am not sure how to structure the message to send GPS location (location semantic type, Geopoint schema) to Azure IoT Central to use in map (telemetry) using Python sdk.

It would be great if there is a Python sample code for this.

Thanks in advance.

Regards,

Vicky

Azure IoT Central
Azure IoT Central

An Azure hosted internet of things (IoT) application platform.

Azure IoT SDK
Azure IoT SDK

An Azure software development kit that facilitates building applications that connect to Azure IoT services.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Dominic 1,706 Reputation points Microsoft Employee
    2022-02-17T16:17:29.407+00:00

    This Python sample shows how to send telemetry to IoT Central: https://github.com/Azure/azure-iot-sdk-python/blob/main/azure-iot-device/samples/pnp/simple_thermostat.py.

    Line 310 sends a simple telemetry type. To send a complex type replace the JSON with that shown in the previous answer from Roman.

    For more information about message structures, take a look at: https://learn.microsoft.com/azure/iot-central/core/concepts-telemetry-properties-commands

    Was this answer helpful?


  2. Roman Kiss 2,246 Reputation points
    2022-02-17T10:52:48.507+00:00

    Hi Vicky,

    the following example shows a Raw data for this telemetry data:

    175365-image.png

    where a location is declared as the following:

    175330-image.png

    Thanks
    Roman

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.