How to stream IoT & telematics data to Thingsboard?

Sending telemetry data from flespi to the Thingsboard IoT platform.

Thingsboard is an open-source IoT platform for device management, data collection, processing, and visualization. This guide shows how to set up streaming data from flespi to Thingsboard assuming that you have already tuned receiving data to flespi Telematics Hub.

1. Create Thingsboard device

You can use your local installed version of Thingsboard or create a demo account on https://demo.thingsboard.io. Go to Devices tab, create a new device and check “is gateway” checkbox — it means that Thingsboard will automatically create a new device if a message with a new “device_name” will be received.

create thingsboard device

2. Get device access token

Open the new device card and copy the access token. It will be used in the next step for stream configuration.

copy device token

3. Configure stream from flespi.io

Create a new stream in the flespi Telematics Hub Streams tab. In the configuration dropdown list select “thingsboard” and fill in the fields:

uri — Thingsboard MQTT broker address. Should be the same as the address you enter into web browser to access Thingsboard (use thingsboard.cloud:1883).

access_token — device token copied on the previous step.

device_name — the field in the message from flespi to Thingsboard that will be used as a device identifier. For most cases, “%ident%” is enough. But if you want to stream a single flespi device you can use a custom static name e.g. “%device_name%”. 

Note: %ident% is the ident mask meaning that the messages from flespi will be sent via the stream with their original ident (IMEI). Usually, there's no need to change this parameter unless you want to distinguish the subset of devices coming from flespi. Then you can add a prefix like this "flespi-%ident%.

That’s it. Now each new message for subscribed instances will be sent to Thingsboard.

Useful tips

The stream publishes the identifier of the newly connected device in the v1/gateway/connected topic to automatically create it. You can also create the device manually.

Manual device creation in Thingsboard

If the Thingsboard device is not created automatically, you can create a new device manually and tie devices in the gateway device Relations tab. 

manually tie devices


Configuring max payload size in Thingsboard

By default, the maximum size of the payload in ThingsBoard to send using MQTT transport is set up to 65536 bytes. If you need to send larger messages, you have to configure the desired size in the thingsboard.yml configuration file. Read more details here https://thingsboard.io/docs/user-guide/install/config/. You need to change the value of transport.mqtt.netty.max_payload_size.

Thingsboard limitations

When flespi to Thingsboard stream was initially implemented Thingsboard didn't has any kind of limitations. However in 2023 we started to receive complains from our users about problems with Thingsboard. After a lot of investigation and communication with Thingsboard support we found out that Thingsboard Cloud currently has such device rate limits for all subscription plans:

  • Transport device messages:
    • 200 messages per 1 sec
    • but less than 6000 messages per 60 sec.
    • but less than 14000 messages per 3600 sec.
  • Transport device telemetry messages:
    • 100 messages per 1 sec
    • but less than 3000 messages per 60 sec.

Be aware that these limits can be changed any time. However in case you noticed any problems with stream operations please first consult Thingsboard support for the information an the actual limits for your account.

To overcome some of these limitations you may use Convert message option in stream configuration and specify only required set of fields to include in each message.

Change log

To stay in sync with all improvements and changes to the Thingsboard stream, subscribe to the change log on the forum

To deliver only certain messages, parameters in it or convert message parameter names into different notation read generic stream configuration.


See also
Apply webhooks to events from calculators to invoke your lambda upon an aggregated event happened to the device
A dedicated plugin enables the visualization of your flespi items parameters in Grafana.