Description
This article will describe how to integrate Milesight Gateway with Thingsboard via MQTT.
Requirement
- Milesight Gateway: UG56, UG65, UG67, UG63 (integrated network server version), UG8x
- ThingsBoard account: ThingsBoard Cloud or install your own platform instance
Configuration
1. Log in to your ThingsBoard account.
2. Go to the Entities > Devices page to add a device.
3. Customize the device name and enable the Whether it is a gateway or not option . If you have already created a device profile, you can also select the corresponding profile. Click Add to save the settings. Note: Click Next: Credentials if you need to customize the client ID and user credentials.
4. Once the device is created, select the MQTT and Windows option and then copy the command to get the MQTT connection information.
In this example, the command is
We can get this information from the command above:
Broker address: mqtt.thingsboard.cloud
Broker's port: 1883
Access token: oarr4qqs3b46fu2hr2t2
Subject: v1/devices/me/telemetry
5. Go to Milesight Network Server Gateway Web GUI > Application > Data Transmission > MQTT to fill in the necessary information. MQTT>General
- Fill in the broker address and broker port according to the information in the last step.
- customize a unique customer ID according to your preferences for good readability.
- Keep connection timeouts and keep-alive intervals by default.
MQTT>User IDs
- check Enable user credentials.
- paste the access token as username .
MQTT>Subject
- fill the U plink data subject as “v1/devices/me/telemetry”.
6. After saving the configurations, check if the status is connected.
7. Go to the Network Server > Device page to add your LoRaWAN devices. The gateway will then transmit the device data to Thingsboard via MQTT.
8. Thingsboard only supports the data formats below:
{"key1": "value1", "key2": "value2"}
Or
[{"key1":"value1"}, {"key2":"value2"}]
So it is necessary to add a payload codec to decode the data in Thingsboard format and add this payload codec to your device. If you are using Milesight LoRaWAN devices, it is suggested to use Milesight's default payload codec. For more details, please refer to the article How to use payload codec on Milesight Gateway .
9. Once the data is successfully downloaded, you will be able to find it in Latest Telemetry .