Changes for page ThingsBoard
Last modified by Dilisi S on 2025/04/02 02:09
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -458,8 +458,6 @@ 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 - 462 - 463 463 [[image:add-integration-connection.png||height="511" width="500"]] 464 464 465 465 ... ... @@ -502,17 +502,29 @@ 502 502 503 503 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. 504 504 505 -The Mosquitto client publishes messages (payloads) on the topic**v1/devices/me/telemetry**.Ofcourse,youcanuse anytopic for testing.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. 506 506 507 - (%id="cke_bm_37386S" style="display:none"%) (%%)The MQTTpayloadformatsasfollows, which iscommon forall **~-~-NB**and**~-~-CB** series devices.The**IMEI**fieldismandatoryandisusedtoprovision anewdevice with thenameassigned to it in ThingsBoard.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. 508 508 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 + 509 509 {{code language="none"}} 510 -{" IMEI": "S31B-NB", "temperature":27,......}522 +{"temperature":10.4, "humidity":85} 511 511 {{/code}} 512 512 513 -Once ThingsBoard receives this message, it automatically creates (provisions) the device mentioned in the **IMEI**, for example, S31B-NB. 514 514 515 - 516 516 == 5.2 Sending messages == 517 517 518 518