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 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

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. Use for the demo platform.

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%”. 

thingsboard stream settings

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

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

The same can be done via Thingsboard API. You can publish a message like {“device”:”new_device_name”} to the topic v1/gateway/connect.

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 You need to change the value of transport.mqtt.netty.max_payload_size.

Change log

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

See also
Sending telemetry data from flespi to RabbitMQ or other AMQP 0-9-1 Broker.
Sending telemetry data from flespi to the GpsGate tracking system.