Description

This article will describe how to integrate Milesight Gateway to Thingsboard via MQTT.


Requirement

  • Milesight Gateway: UG56, UG65, UG67, UG63 (embedded network server version), UG8x
  • ThingsBoard Account:ThingsBoard Cloud or install your own platform instance



Configuration

1. Log in your ThingsBoard account.

2. Go to Entities > Devices page to add a device.

3. Customize the device name and enable Whether it is a gateway or not option. If you already created device profile, you can also select corresponding profile. Click Add to save the settings. Note: click Next: Credentials if you need to customize the client ID and user credentials.
 

4. After device created, select MQTT and Windows option, then copy the command to get MQTT connection information.


In this example, the command is 

mosquitto_pub -d -q 1 -h mqtt.thingsboard.cloud -p 1883 -t v1/devices/me/telemetry -u "oarr4qqs3b46fu2hr2t2" -m "{temperature:25}"

We can get these information from above command:

Broker address: mqtt.thingsboard.cloud

Broker port: 1883

Access token: oarr4qqs3b46fu2hr2t2

Topic: v1/devices/me/telemetry



5. Go to Milesight gateway web GUI Network Server > Application > Data Transmission > MQTT to fill in necessary information.MQTT>General

  • fill in Broker Address and Broker port according to the information of last step.
  • customize a unique Client ID to your preference for good readability.
  • keep Connection Timeouts and Keep Alive Intervals as default.

MQTT>User Credentials

  • check Enable user credentials.
  • paste the Access Token as Username.

MQTT>Topic

  • fill in Uplink data’s topic as “v1/devices/me/telemetry”.


6. After saving the configurations, check if the status is connected.


7. Go to Network Server > Device page to add your LoRaWAN devices. Then the gateway will forward device data to Thingsboard via MQTT.

8. Thingsboard only support below data formats: 

{"key1":"value1", "key2":"value2"} 

or

 [{"key1":"value1"}, {"key2":"value2"}]


So it is necessary to add a payload codec to decode data as Thingsboard format and add this payload codec to your device. If you use Milesight LoRaWAN devices, it is suggested to use Milesight default payload codec. For more details please refer to article How to Use Payload Codec on Milesight Gateway.


9. After data are uploaded successfully, you could find it in the Latest telemetry.



----END----