<
From version < 158.1 >
edited by Dilisi S
on 2025/03/18 03:15
To version < 161.1 >
edited by Dilisi S
on 2025/03/18 04:12
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -458,6 +458,7 @@
458 458  * **Topic: v1/devices/+/telemetry** (the + replaces any 'device name' will create a device in the Entities -> Devices)
459 459  * **QoS:** 0-At most once
460 460  
461 +
461 461  [[image:add-integration-connection.png||height="511" width="500"]]
462 462  
463 463  
... ... @@ -500,36 +500,24 @@
500 500  
501 501  We use the Mosquitto MQTT client to simulate MQTT messages, acting as a virtual device. First, install the Mosquitto client on your computer from [[this link>>url:https://mosquitto.org/download/]]. The Mosquitto client publishes messages to the MQTT broker (HiveMQ) on a specified MQTT topic. ThingsBoard subscribes to these messages using the same topic.
502 502  
503 -The Mosquitto client publishes messages on the topic v1/devices/[device_name]/telemetry. The [device_name]placeholder can be replaced with any device name, for example, 'S31B-NB'. Then, the MQTT topic would be v1/devices/S31B-NB/telemetry.
504 +The Mosquitto client publishes messages (payloads) on the topic **v1/devices/me/telemetry**. Of course, you can use any topic for testing.
504 504  
505 -On the ThingsBoard side, we configure the MQTT topic subscription as v1/devices/+/telemetry. The + wildcard represents any device name and allows ThingsBoard to automatically create (provision) a device with that name, such as S31B-NB, for example.
506 +(% id="cke_bm_37386S" style="display:none" %) (%%)The MQTT payload format is as follows, which is common for all **~-~-NB** and **~-~-CB** series devices. The **IMEI** field is mandatory and is used to provision a new device with the name assigned to it in ThingsBoard.
506 506  
507 -
508 -**The new device is created the first time the MQTT topic is received. For subsequent MQTT topics with the same device name, no duplicate devices will be created.**
509 -
510 -
511 -For example, if you send two MQTT messages with different device names in the topic:
512 -
513 -1. v1/devices/**S31B-NB**/telemetry
514 -1. v1/devices/**LDS25-NB**/telemetry
515 -
516 -ThingsBoard will create two devices named **S31B-NB** and **LDS25-NB** in the **//Devices//** section.
517 -
518 -
519 -The MQTT payload format is as follows, which is common for all ~-~-NB and ~-~-CB series devices:
520 -
521 521  {{code language="none"}}
522 -{"temperature":10.4, "humidity":85}
509 +{"IMEI": "S31B-NB", "temperature": 27, ......}
523 523  {{/code}}
524 524  
512 +Once ThingsBoard receives this message, it automatically creates (provisions) the device mentioned in the **IMEI**, for example, S31B-NB.
525 525  
514 +
526 526  == 5.2 Sending messages ==
527 527  
528 528  
529 -On the terminal, issue the following MQTT command which simulates the device S31B-NB. The message payload contains the fields temperature and humidity, which hold the values 10.4 and 85, respectively. This payload is also (technically) known as telemetry.
518 +On the terminal, issue the following MQTT command which simulates the device S31B-NB. The message payload contains the fields temperature and humidity, which hold the values S31B-NB and 27, respectively. This payload is also (technically) known as telemetry.
530 530  
531 531  {{code language="none"}}
532 -mosquitto_pub -d -q 1 -h 011731f7928xxxxx.s1.eu.hivemq.cloud -p 8883 -t "tb/mqtt-integration-tutorial/sensors/S31B-NB/telemetry" -u "xxxxx" -P "xxxxx" -m '{"temperature":10.4, "humidity":85}'
521 +mosquitto_pub -d -q 1 -h 011731f7928xxxxx.s1.eu.hivemq.cloud -p 8883 -t "v1/devices/me/telemetry" -u "xxxxx" -P "xxxxx" -m '{"IMEI": "S31B-NB", "temperature": 27}'
533 533  {{/code}}
534 534  
535 535  If the integration was performed without errors, the status of the integration changes to 'Active' after the first telemetry transmission.
... ... @@ -541,9 +541,10 @@
541 541  Also, a new device named **S31B-NB** will appear under **//Entities -> Devices -> All//**. This means the first MQTT message triggers ThingsBoard to provision a device named **S31B-NB**.
542 542  
543 543  
544 -[[image:device-provision-1.png]]
545 545  
534 +[[image:new-device.png]]
546 546  
536 +
547 547  Click on the device S31B-NB on the devices list to see its details.
548 548  
549 549  Then go to the **Latest telemetry** tab.
new-device.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.pradeeka
Size
... ... @@ -1,0 +1,1 @@
1 +143.3 KB
Content
Copyright ©2010-2024 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0