Skip to main content
All CollectionsUser Guides
How to Connect the Milesight Gateway to Ubidots via MQTT
How to Connect the Milesight Gateway to Ubidots via MQTT

Learn how to configure your Milesight IoT Gateway to be able to transmit data to Ubidots using MQTT Protocol.

Sergio M avatar
Written by Sergio M
Updated over 4 months ago

Milesight LoRaWAN Gateways provide an MQTT API to transmit LoRaWAN device data from the Gateway built-in network server to the MQTT broker. This article will guide you to transmit LoRaWAN device data to Ubidots via Milesight Gateways.

Requirements

1. Connect Gateway to Ubidots via MQTT

Step 1: Go to Packet Forwarder > General to enable Embedded NS type network server into the localhost Server Address.

Step 2: In the Network Server > General, enable the Gateway built-in network server.

Step 3: Go to Network Server > Applications to add an application, then click Save.

Step 4: Add Data Transmission for this application, select MQTT as type.

Step 5: Fill in the information of Ubidots MQTT broker.

  • Broker Address: industrial.api.ubidots.com

  • Broker Port: 1883

  • Client ID: User-defined (between 10 to 20 random character length)

  • User Credentials: Enable

  • Username: Your Ubidots account TOKEN (How to find Ubidots account TOKEN)

  • Password: Leave blank

For more information about Ubidots MQTT broker please refer here.

To send data to Ubidots broker, you need to publish the topic: /v1.6/devices/$deveui

Step 6: Save all settings, then you can check the MQTT status.

2. Add a LoRaWAN Device to the Gateway

Step 1: Go to Network Server > Profiles to add a device profile according to device type.

Step 2: In the Network Server > Device add a device, select the correct device profile and the application connected to Ubidots, then fill in the device information (Device EUI, App key, etc.).

Once a new value is received in the Gateway from the device, a new device will be automatically created into your Ubidots account.

You can check if the Gateway receives data on Network Server > Device page.

3. Add Payload Decoder

Step 1: Go to Network Server > Payload Codec and go down to Custom Payload Codec section.

Step 2: Select a template for your Payload Codec, depending on the device you want to connect to your Gateway. You can also modify it if you want.

IMPORTANT NOTES:

  • This Payload Codec only applies to the devices under this application. If you need to use other decoders, please create a new application.

  • For more details about the Payload Codec please refer to How to Use Payload Codec on Milesight Gateway.

  • Ubidots only supports numerical data as values, please ensure all your up-link data types are numbers. To send non-numerical values, please refer to Ubidots Hardware documentation to learn how.

4. Data Visualization

Step 1: Select the device created to verify the variables received.

Step 2: Change the device name to a friendly one if needed.

Step 3: Go to Data -> Dashboard section of your Ubidots account to create a dashboard.


Step 4: Select the plus (+) icon located a the upper right side of the page to add widgets to display your data. Learn more about Ubidots’ Dashboards.

Did this answer your question?