{"id":26611,"date":"2025-07-14T07:40:04","date_gmt":"2025-07-14T14:40:04","guid":{"rendered":"https:\/\/tdengine.com\/?p=26611"},"modified":"2025-07-28T15:20:45","modified_gmt":"2025-07-28T22:20:45","slug":"integrate-tdengine-with-thingsboard","status":"publish","type":"post","link":"https:\/\/tdengine.com\/integrate-tdengine-with-thingsboard\/","title":{"rendered":"Integrate TDengine with ThingsBoard"},"content":{"rendered":"\n<p>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\u2019s device profile to TDengine\u2019s 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.<\/p>\n\n\n\n<figure class=\"gb-element-e24677be\">\n<img decoding=\"async\" width=\"1024\" height=\"385\" class=\"gb-media-59f14249\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/thingsboard-1.png?strip=all&sharp=1\" alt=\"\" title=\"thingsboard\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/thingsboard-1.png?strip=all&amp;sharp=1 1024w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/thingsboard-1-300x113.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/thingsboard-1-768x289.png?strip=all&amp;sharp=1 768w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/thingsboard-1.png?strip=all&amp;sharp=1&amp;w=204 204w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/thingsboard-1.png?strip=all&amp;sharp=1&amp;w=409 409w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/thingsboard-1.png?strip=all&amp;sharp=1&amp;w=614 614w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/thingsboard-1.png?strip=all&amp;sharp=1&amp;w=819 819w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/>\n<\/figure>\n\n\n\n<h2 class=\"gb-text\">About ThingsBoard<\/h2>\n\n\n\n<p><a href=\"https:\/\/thingsboard.io\/\" rel=\"noopener\">ThingsBoard<\/a> 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.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"gb-text\">About TDengine<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"gb-text\">Procedure<\/h2>\n\n\n\n<ol>\n<li>\n<p>Install ThingsBoard as described in the official documentation: <a class=\"\" href=\"https:\/\/thingsboard.io\/docs\/user-guide\/install\/ubuntu\/\" rel=\"noopener\">https:\/\/thingsboard.io\/docs\/user-guide\/install\/ubuntu\/<\/a><\/p>\n<\/li>\n\n\n\n<li>\n<p>Add TDengine-related connection settings to the configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-bash\" data-line=\"\"># spring.tdengine\nexport TDENGINE_URL=jdbc:TAOS-RS:\/\/127.0.0.1:6041\/thingsboard\nexport TDENGINE_USERNAME=root\nexport TDENGINE_PASSWORD=taosdata\nexport TDENGINE_STR_LEN=1024\nexport TDENGINE_STR_COL_MAX=65517\nexport TDENGINE_STR_TAG_MAX=16382<\/code><\/pre>\n<\/li>\n\n\n\n<li>\n<p>Call the API to create a device profile.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-bash\" data-line=\"\">curl -X POST &#039;http:\/\/127.0.0.1:8080\/api\/deviceProfile&#039; \\\n--header &#039;Content-Type: application\/json&#039; \\\n--header &#039;Authorization: Bearer $YOUR_JWT_TOKEN_HERE&#039; \\\n--data-raw &#039;{\n    &quot;name&quot;: &quot;truck&quot;,\n    &quot;type&quot;: &quot;DEFAULT&quot;,\n    &quot;image&quot;: null,\n    &quot;defaultQueueName&quot;: null,\n    &quot;transportType&quot;: &quot;DEFAULT&quot;,\n    &quot;provisionType&quot;: &quot;DISABLED&quot;,\n    &quot;description&quot;: &quot;&quot;,\n    &quot;profileData&quot;: {\n        &quot;configuration&quot;: {\n            &quot;type&quot;: &quot;DEFAULT&quot;\n        },\n        &quot;transportConfiguration&quot;: {\n            &quot;type&quot;: &quot;DEFAULT&quot;\n        },\n        &quot;alarms&quot;: null,\n            &quot;provisionConfiguration&quot;: {\n            &quot;type&quot;: &quot;DISABLED&quot;\n        }\n    },\n    &quot;tableInfo&quot;: {\n        &quot;columns&quot;: [{&quot;name&quot;:&quot;longtitude&quot;,&quot;type&quot;:&quot;double&quot;,&quot;len&quot;:10},{&quot;name&quot;:&quot;latitude&quot;,&quot;type&quot;:&quot;double&quot;},{&quot;name&quot;:&quot;speed&quot;,&quot;type&quot;:&quot;float&quot;}],\n        &quot;tags&quot;: [{&quot;name&quot;:&quot;license_plate_number&quot;,&quot;type&quot;:&quot;nchar&quot;,&quot;len&quot;:8}]\n    }\n}&#039;<\/code><\/pre>\n\n\n\n<p>At this point we have successfully created a device profile in ThingsBoard and a corresponding supertable in TDengine.<\/p>\n<\/li>\n\n\n\n<li>\n<p>Select the existing profile and create a device.<\/p>\n\n\n\n<p>After creating a device in ThingsBoard, you can click <strong>Copy Device ID<\/strong> to find the corresponding subtable name in TDengine.<\/p>\n<\/li>\n\n\n\n<li>\n<p>Test data ingestion by calling the API:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-bash\" data-line=\"\">curl -X POST &#039;http:\/\/127.0.0.1:8080\/api\/v1\/$YOUR_DEVICE_TOKEN\/telemetry&#039; \\\n--header &#039;Content-Type: application\/json&#039; \\\n--data-raw &#039;{&quot;license_plate_number&quot;:&quot;ABC123&quot;,&quot;longtitude&quot;:108.938744,&quot;latitude&quot;:34.368150,&quot;speed&quot;:60}&#039;<\/code><\/pre>\n<\/li>\n<\/ol>\n\n\n\n<p>You can now view the test data in ThingsBoard and in TDengine.<\/p>\n\n\n\n<h2 class=\"gb-text\">Usage Ideas<\/h2>\n\n\n\n<h3 class=\"gb-text\">Scenario 1: Real-Time Vehicle Tracking<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Data Collection:<\/strong> Vehicle GPS location data is transmitted to ThingsBoard every second.<\/li>\n\n\n\n<li><strong>Data Storage:<\/strong> A table is created in TDengine to store the location data.<\/li>\n\n\n\n<li><strong>Data Visualization:<\/strong> A geographic map widget is set up in ThingsBoard to display the vehicle&#8217;s real-time position.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"gb-text\">Scenario 2: Fleet Maintenance Alerts<\/h3>\n\n\n\n<p><strong>Daily Metric Generation:<\/strong> 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:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-sql\" data-line=\"\">create stream high_speed fill_history 1 into high_speed subtable(concat(&#039;tb_&#039;, device_name)) as select _wstart, count(speed),device_name from `1e169050-86e6-11ef-a5cf-2de52a1b0351` where speed &gt; 90 partition by device_name interval(1d);<\/code><\/pre>\n\n\n\n<p><strong>Note:<\/strong> This integration does not modify the existing frontend interface. Device profiles need to be created by calling the HTTP API.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Integrating TDengine with ThingsBoard enables seamless data collection, storage, analysis, and visualization for industrial IoT scenarios.<\/p>\n","protected":false},"author":127,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[21],"tags":[],"ppma_author":[261],"class_list":["post-26611","post","type-post","status-publish","format-standard","hentry","category-engineering"],"authors":[{"term_id":261,"user_id":127,"is_guest":0,"slug":"jfan","display_name":"Jim Fan","avatar_url":"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/jfan-profile-new.jpg?strip=all&#038;sharp=1&#038;resize=96%2C96","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/26611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/users\/127"}],"replies":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/comments?post=26611"}],"version-history":[{"count":4,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/26611\/revisions"}],"predecessor-version":[{"id":26774,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/26611\/revisions\/26774"}],"wp:attachment":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/media?parent=26611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/categories?post=26611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/tags?post=26611"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/ppma_author?post=26611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}