{"id":4956,"date":"2022-02-22T20:11:18","date_gmt":"2022-02-23T04:11:18","guid":{"rendered":"https:\/\/tdengine.com\/?p=4956"},"modified":"2025-11-03T07:52:52","modified_gmt":"2025-11-03T15:52:52","slug":"using-mosquitto-tdengine-grafana-to-set-up-the-data-platform-for-smart-massage-devices","status":"publish","type":"post","link":"https:\/\/tdengine.com\/using-mosquitto-tdengine-grafana-to-set-up-the-data-platform-for-smart-massage-devices\/","title":{"rendered":"Building a Data Collection Platform for Smart Devices"},"content":{"rendered":"\n<h2 class=\"gb-headline gb-headline-75990f5a gb-headline-text\">Introduction<\/h2>\n\n\n\n<p>The Lyric is the result of a two-year project and the convergence of thinking of a distinguished team of world-leading experts, entrepreneurs and investors drawing on consumer research as well as experience working across some of the most iconic brands. The Lyric was developed to address unmet consumer needs spanning form, function and accessibility. Say goodbye to ugly, cumbersome, aggressive and heavy massage guns made only for elite athletes. The stylishly designed Lyric was created with everybody and every body in mind, delivering intuitive and easy-to-use technology at an affordable price. Now, you don\u2019t have to sacrifice quality or make a tough choice between features when deciding on self-care. With the Lyric, you can have what you want and what your body needs.&nbsp;<\/p>\n\n\n\n<h2 class=\"gb-headline gb-headline-1e845291 gb-headline-text\">Data Needs<\/h2>\n\n\n\n<p>In order to better serve our customers, we need to collect and analyze usage data from the Lyric, gain insights from data and make product decisions based on them. For this, we decided to deploy a <a href=\"https:\/\/tdengine.com\/what-is-a-time-series-database\/\">time series database<\/a> (TSDB) TDengine made it extremely easy to get started and integrate with, with just a few lines of code, we are able to collect data immediately<\/p>\n\n\n\n<h3 class=\"gb-headline gb-headline-345fe496 gb-headline-text\">Integration Details<\/h3>\n\n\n\n<p>Data collection is implemented by the integration of MQTT logging. It uses a secure connection to TDengine hosted servers.<\/p>\n\n\n\n<p>The events currently logged are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>connect<\/li>\n\n\n\n<li>disconnect<\/li>\n\n\n\n<li>start<\/li>\n\n\n\n<li>stop<\/li>\n\n\n\n<li>level<\/li>\n\n\n\n<li>ota&nbsp;<\/li>\n<\/ul>\n\n\n\n<p>Each message includes the device ID and software version. The ID is always redundant because it is used as the user ID for MQTT login. The version is redundant after the first time. Ideally it would only be included with the connect event.&nbsp; (Minimizing message size is important as the on-device network transmit buffers can become full when connectivity is weak, requiring a connection reset.)&nbsp;<\/p>\n\n\n\n<p>The mosquitto_sub tool is a convenient way to monitor MQTT events. There are many ways to install mosquitto if you don&#8217;t have it already. To monitor all Lyric events on TDengine server,, use this command line:<\/p>\n\n\n\n<p>The output looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-code language-json\"><code class=\"\" data-line=\"\">{&quot;event&quot;:&quot;connect&quot;,&quot;id&quot;:&quot;FDD3F6F0688784214A606AADDD01E336&quot;,&quot;version&quot;:&quot;0.8.7&quot;}\n{&quot;event&quot;:&quot;start&quot;,&quot;title&quot;:&quot;Calm&quot;,&quot;name&quot;:&quot;Manual&quot;,&quot;level&quot;:1,&quot;id&quot;...\n{&quot;event&quot;:&quot;stop&quot;,&quot;id&quot;...\n{&quot;event&quot;:&quot;start&quot;,&quot;title&quot;:&quot;Calm&quot;,&quot;name&quot;:&quot;Guided&quot;,&quot;level&quot;:1,&quot;id&quot;...\n{&quot;event&quot;:&quot;level&quot;,&quot;level&quot;:2,&quot;id&quot;...\n{&quot;event&quot;:&quot;level&quot;,&quot;level&quot;:3,&quot;id&quot;...\n{&quot;event&quot;:&quot;level&quot;,&quot;level&quot;:1,&quot;id&quot;...\n{&quot;event&quot;:&quot;stop&quot;,&quot;id&quot;...\n{&quot;event&quot;:&quot;disconnect&quot;,&quot;id&quot;...<\/code><\/pre>\n\n\n\n<h3 class=\"gb-headline gb-headline-cdc8c467 gb-headline-text\">Visualization<\/h3>\n\n\n\n<p>Once these semi structured events are hosted on TDengine\u2019s server, picking a visualization tool is easy as well, we picked Grafana as it is highly customizable. End results are simple to digest, actionable, real time usage data on the Lyric that we depend on everyday!<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-1e8ef5f9\"><img decoding=\"async\" width=\"1600\" height=\"709\" class=\"gb-image gb-image-1e8ef5f9\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.019-01-dashboard.jpeg?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.019-01-dashboard.jpeg?strip=all&amp;sharp=1 1600w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.019-01-dashboard-300x133.jpeg?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.019-01-dashboard-1024x454.jpeg?strip=all&amp;sharp=1 1024w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.019-01-dashboard-768x340.jpeg?strip=all&amp;sharp=1 768w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.019-01-dashboard-1536x681.jpeg?strip=all&amp;sharp=1 1536w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.019-01-dashboard.jpeg?strip=all&amp;sharp=1&amp;w=640 640w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.019-01-dashboard.jpeg?strip=all&amp;sharp=1&amp;w=960 960w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.019-01-dashboard.jpeg?strip=all&amp;sharp=1&amp;w=1280 1280w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.019-01-dashboard.jpeg?strip=all&amp;sharp=1&amp;w=450 450w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<h2 class=\"gb-headline gb-headline-b8c044ca gb-headline-text\">Summary&nbsp;<\/h2>\n\n\n\n<p>We see these benefits of using TDengine<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Easy integration, clear documentation, took us just a few lines of code to start collecting data<\/li>\n\n\n\n<li>TDengine\u2019s service is fast and reliable, with real time data ingestion and high availability<\/li>\n\n\n\n<li>Highly customizable data visualization tooling, many integration possibilities<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The makers of the Lyric chose TDengine to collect and analyze IoT usage data from their massage gun product.<\/p>\n","protected":false},"author":82,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[23],"tags":[],"ppma_author":[168],"class_list":["post-4956","post","type-post","status-publish","format-standard","hentry","category-case-studies"],"authors":[{"term_id":168,"user_id":82,"is_guest":0,"slug":"nathanlyric","display_name":"Nathan (Lyric)","avatar_url":{"url":"https:\/\/tdengine.com\/wp-content\/uploads\/29.04-26-lyric.jpeg","url2x":"https:\/\/tdengine.com\/wp-content\/uploads\/29.04-26-lyric.jpeg"},"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/4956","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\/82"}],"replies":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/comments?post=4956"}],"version-history":[{"count":8,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/4956\/revisions"}],"predecessor-version":[{"id":29431,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/4956\/revisions\/29431"}],"wp:attachment":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/media?parent=4956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/categories?post=4956"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/tags?post=4956"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/ppma_author?post=4956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}