[IoT Central] Best way to send telemetry data from Flutter application

Julien KERN 25 Reputation points
2023-05-12T14:21:35.7366667+00:00

Hi,

We plan to develop a Flutter application sending telemetry to a IoT Central application. This app should be compatible for Android and iOS.

I can see on the documentation that the Microsoft Azure IoT SDK does exist in C, C#, Java, JavaScript & Python (https://learn.microsoft.com/en-us/azure/iot-central/core/tutorial-connect-device?pivots=programming-language-python), which won't be compatible with a cross platform Flutter application.

It also seems that the IoT Central API does not provide a way to send telemetry data (https://learn.microsoft.com/en-us/rest/api/iotcentral/).

I was then thinking to build an Azure Function that uses the Microsoft Azure IoT SDK.

  • Is that a good approach ?
    • If No, how would you achieve this goal ?
    • If Yes, do you have some tips ?

Best regards.

Julien.

Azure IoT Central
Azure IoT Central
An Azure hosted internet of things (IoT) application platform.
342 questions
{count} votes

Accepted answer
  1. Sander van de Velde 28,236 Reputation points MVP
    2023-05-14T20:56:12.4366667+00:00

    Hello Julien KERN,

    it seems you want to send messages from one application to Azure IoT Central as if these messages are coming from multiple devices.

    This pattern is already described here and a sample implementation is found on GitHub.

    You can modify this 'bridge' to your own needs.

    Each incoming message (of your own format) is transformed into a message to be sent to the IoT Central portal. The bridge checks if the device needs to be provisioned first based on the device id.

    You are free to modify it as much as needed but the solution is quite straightforward.

    More details based on The Things Network are seen here.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    2 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. LeelaRajeshSayana-MSFT 13,456 Reputation points
    2023-05-12T20:07:40.97+00:00

    @Julien KERN Greetings! Welcome to Microsoft Q&A forum! Thank you for posting the question here. It is an interesting use case, and we haven't encountered this yet.

    As you observed, there is no SDK compatible with Dart language that has been tested yet. The programming languages offered in the tutorial Create and connect a client application to your Azure IoT Central application also provide references to the Underlying GitHub repositories of the respective SDK. You can probably leverage the code samples and extrapolate the implementation to Dart. However, it is a complex and laborious task as there are lot of dependencies that needs to be resolved.

    I would definitely recommend going with using an Azure function as it would be easier to implement. Please refer the related question How to generate custom telemetry string data for a simulated device sensor in IoT Central where a solution has been shared on how to send simulated Data to a device on IoT Central with a custom device Template.

    Hope this helps. Please let us know if you have any additional questions in the comments below and we would be glad to help you further.


    If the response helped, please do click Accept Answer and Yes. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.


  2. Dom 1,466 Reputation points Microsoft Employee
    2023-05-15T10:38:01.19+00:00

    Another option to consider:

    The internal IoT Hub(s) in an IoT Central application support the MQTT protocol for client devices to send telemetry (for background see: https://learn.microsoft.com/azure/iot/iot-mqtt-connect-to-iot-hub).

    A quick web search shows you can use MQTT from a Flutter app, for example: https://pub.dev/packages/mqtt_client

    0 comments No comments