Introduction
Milesight LoRaWAN® gateways provide MQTT API to transmit LoRaWAN® device data from gateway built-in network server to MQTT broker. This article will guide you to transmit LoRaWAN® device data to Tago via Milesight gateways and split every device from gateway traffics.
Requirements
- Milesight LoRaWAN®Gateway: UG6x, UG8x
- LoRaWAN®Sensor/Node: take EM300-SLD as an example
- Tago Account
Configuration
Step 1. Connect Gateway to Tago
- Go to Tago Device tab, click +Add Device to add a custom MQTT device. In this example, the device name is UG65.After creating, you can find the device token in the device page.
- Go to Packet Forwarder ->General to enable embedded NS, then go to Network Server -> General to enable the embedded NS.
- Go to Network Server-> Applications to add an application, then click Save.
- Add a Data Transmissionfor this application, select MQTT as type.
Fill in the information of Tago MQTT broker.
- Broker Address: mqtt.tago.io
- Broker Port: 1883
- Client ID: User-defined
- User Credentials: Enable
- Username: Token
- Password: device token copied from Tago UG65 device Page
For more information about Tago MQTT broker please refer to this page.
Define an uplink publish topic, in this example the topic is /mqtttest
- Save all settings, then you can check the MQTT status.
Step 2. Add LoRaWAN® Device to Gateway
Add LoRaWAN® node to Milesight gateway referring to How to Connect LoRaWAN Nodes to Milesight Gateway. After connection, you can check if gateway receives data in Network Server -> Packets page.
Besides, you can check if node data are sent to Tago.
Step 3. Split up Devices from Gateway in Tago
Since one application can include many devices, Tago provides several steps below to divide every device.
- Go to Integration ->Network to add a network. In this example, the network name is UG65 Network
- After creating, enable the Serial Number setting and generate a network token, then save the settings.
- Go to Integration ->Connector to add a connector. When adding, select the network you created. You can create connectors for different device types and add corresponding information and decoders.
- Click here to install Device Split Up analysis template and re-name it. In this template, you can find the example code to define every device and upload every item to Tago. Please change the tamplete code Const devaddr=scope[0].devaddr to Const devaddr=scope[0].devEUI. You can also edit codes to define the information you need to receive by yourself.
- Copy the UG65 Network token to Environment variables, then save all template settings.
- Go to Actiontab to add an action, select the type as MQTT Topic and action as Run Analysis, then select the analysis you created.In the action page, select the UG65 gateway device and fill in the uplink MQTT topic you created in your Milesight gateway, then save all settings.
- Go to Device tab, select the network you created under My Network, click the EM300 connector to add a device.Fill in the device EUI as serial number, then click Create my Device.
- In this device page, you can only see this device data upload.
--END--