Integrate TDengine with ThingsBoard

Joel Brass

July 14, 2025 /

Integrating TDengine with ThingsBoard brings together a high-performance time-series database and a powerful open-source IoT platform, enabling seamless data collection, storage, analysis, and visualization for industrial and IoT scenarios. By mapping ThingsBoard’s device profile to TDengine’s supertable structure, each new device created in ThingsBoard automatically generates a corresponding subtable in TDengine. This not only simplifies data modeling and management but also ensures efficient, real-time storage of telemetry data with minimal configuration, offering a robust and scalable foundation for building smart IoT applications.

About ThingsBoard

ThingsBoard is a versatile, open-source IoT platform that streamlines the development, deployment, and management of connected device ecosystems. It supports industry-standard protocols such as MQTT, CoAP, and HTTP, enabling seamless data collection, processing, and visualization on-premises or in the cloud.

With built-in features like device provisioning, a powerful rule engine for event processing, customizable dashboards, alarms, and multi-tenancy support, ThingsBoard empowers users to scale from small prototypes to large-scale IoT solutions with robustness, fault tolerance, and rich extensibility.

About TDengine

TDengine is a time-series database purpose-built for Industry 4.0 and Industrial IoT. It enables real-time ingestion, storage, analysis, and distribution of petabytes of data per day, generated by billions of sensors and data collectors.

Procedure

  1. Install ThingsBoard as described in the official documentation: https://thingsboard.io/docs/user-guide/install/ubuntu/

  2. Add TDengine-related connection settings to the configuration file:

    # spring.tdengine
    export TDENGINE_URL=jdbc:TAOS-RS://127.0.0.1:6041/thingsboard
    export TDENGINE_USERNAME=root
    export TDENGINE_PASSWORD=taosdata
    export TDENGINE_STR_LEN=1024
    export TDENGINE_STR_COL_MAX=65517
    export TDENGINE_STR_TAG_MAX=16382
  3. Call the API to create a device profile.

    In this article we use a vehicle management system as an example. We need to record several variables such as license plate number, data reporting time, longitude, latitude, and speed.

    curl -X POST 'http://127.0.0.1:8080/api/deviceProfile' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer $YOUR_JWT_TOKEN_HERE' \
    --data-raw '{
        "name": "truck",
        "type": "DEFAULT",
        "image": null,
        "defaultQueueName": null,
        "transportType": "DEFAULT",
        "provisionType": "DISABLED",
        "description": "",
        "profileData": {
            "configuration": {
                "type": "DEFAULT"
            },
            "transportConfiguration": {
                "type": "DEFAULT"
            },
            "alarms": null,
                "provisionConfiguration": {
                "type": "DISABLED"
            }
        },
        "tableInfo": {
            "columns": [{"name":"longtitude","type":"double","len":10},{"name":"latitude","type":"double"},{"name":"speed","type":"float"}],
            "tags": [{"name":"license_plate_number","type":"nchar","len":8}]
        }
    }'

    At this point we have successfully created a device profile in ThingsBoard and a corresponding supertable in TDengine.

  4. Select the existing profile and create a device.

    After creating a device in ThingsBoard, you can click Copy Device ID to find the corresponding subtable name in TDengine.

  5. Test data ingestion by calling the API:

    curl -X POST 'http://127.0.0.1:8080/api/v1/$YOUR_DEVICE_TOKEN/telemetry' \
    --header 'Content-Type: application/json' \
    --data-raw '{"license_plate_number":"ABC123","longtitude":108.938744,"latitude":34.368150,"speed":60}'

You can now view the test data in ThingsBoard and in TDengine.

Usage Ideas

Scenario 1: Real-Time Vehicle Tracking

  • Data Collection: Vehicle GPS location data is transmitted to ThingsBoard every second.
  • Data Storage: A table is created in TDengine to store the location data.
  • Data Visualization: A geographic map widget is set up in ThingsBoard to display the vehicle’s real-time position.

Scenario 2: Fleet Maintenance Alerts

Daily Metric Generation: Assume that you need to calculate the number of times each vehicle exceeds the speed limit per day. You could create a stream processing task in TDengine to perform real-time computation as follows:

create stream high_speed fill_history 1 into high_speed subtable(concat('tb_', device_name)) as select _wstart, count(speed),device_name from `1e169050-86e6-11ef-a5cf-2de52a1b0351` where speed > 90 partition by device_name interval(1d);

Note: This integration does not modify the existing frontend interface. Device profiles need to be created by calling the HTTP API.

  • Joel Brass
    Joel Brass

    Joel Brass is a Solutions Architect at TDengine, bringing extensive experience in real-time data processing, time-series analytics, and full-stack development. With a 20 year background in software engineering and a deep focus on scalable applications and solutions, Joel has worked on a range of projects spanning joke databases, IoT, self-driving vehicles, and work management platforms. Prior to joining TDengine, Joel worked in Advisory Services for Enterprise customers of Atlassian and the Systems Engineering team at Waymo. He is currently based in the San Francisco Bay Area.