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.
Table of Contents
Connect a Milesight Gateway to Ubidots via MQTT
Add a LoRaWAN Device to the Gateway
Add Payload Decoder
1. Connect Gateway to Ubidots via MQTT
Step 1: Go to Packet Forwarder > General to enable Milesight type network server.
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.
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:
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 > Packets page.
3. Add Payload Decoder
Step 1: Go to Network Server > Application to select the application connected to Ubidots, then select Payload Codec as Custom and fill in the LoRaWAN device decoder. In this example, we add the AM107 decoder for the AM107 device.
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.