• 1 x Mileisght UG65/UG67/UG85/UG87
  • Custom ThingsBoard platform



According to ThingsBoard official document, the platform can use MQTT to publish device activations and messages, and allow you to publish a message for a specific device in response. But ThingsBoard only receives messages in certain format under special topic, and surely Milesight gateway can modify both to fulfill.



  1. You will need to have ThingsBoard server up and running. The easiest way is to use Live Demo
  2. For simplicity, we will provision the device manually using the UI.
  • Login to your ThingsBoard instance and open the Devices page.
  • Click on the "+" icon in the top right corner of the table and then select "Add new device".
  • Input device name. For example, "My New Device". No other changes required at this time. Click "Add" to add the device.
  • Now your device should be listed first, since the table sort devices using the time of the creation by default.

3. To connect the device you need to get the device credentials first. ThingsBoard supports various device credentials. We recommend using defaultauto-generated credentials which are accessible tokens for this guide.

  • Click on the device row in the table to open device details
  • Click "Copy access token". Token will be copied to your clipboard. Save it to a safe place.

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


  • fill in Broker Address with your custom ThingsBoard machine IP address and corresponding port.
  • type in a uniqueClient ID to your preference for good readability.
  • keep Connection Timeouts and Keep Alive Intervals as default.

MQTT>User Credentials

  • check Enable user credentials.
  • use the Access Token for this gateway that was generated on ThingsBoard>Device Group as the Username, and “123” as the password (ThingsBoard doesn’t check the password here, you can put in anything instead of leaving it blank).


  • must fill in Uplink data’s topic as “v1/devices/me/telemetry”.
  • leave the rest as default.

Payload Codec Modification

Thingsboard supported data formats are:

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


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

But Milesight gateway reports:


This difference can be fixed by 1) modification on ThingsBoard to support such format, 2) use payload codec in UG gateway’s Application to report like required.

Details on modification on ThingsBoard are not included in this document, if you’d like the second option, please refer to How to Use Payload Codec on Milesight Gateway.

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