Need a quote? A specific configuration, a project? Contact us on 02 51 99 13 03 .

How to connect Milesight Gateway to Tago via MQTT

Comment connecter Milesight Gateway à Tago via MQTT

luna fouilleul |

Introduction

Milesight LoRaWAN® gateways provide an MQTT API to transmit LoRaWAN® device data from the gateway's built-in network server to the MQTT broker. This article will guide you to transmit data from LoRaWAN® devices to Tago through Milesight gateways and separate each device from gateway traffic.

Requirements

  • Milesight LoRaWAN® Gateway: UG6x, UG8x
  • LoRaWAN®Sensor/Node: take EM300-SLD as an example
  • Tago Account

Configuration

Step 1. Connect Gateway to Tago

  1. Go to the tab Device Tag, click +Add a device to add a custom MQTT device. In this example, the device name is UG65 .
    After creation, you can find the device token on the device page.
  2. Go to Packet Forwarder -> General to enable built-in NS, then navigate to Network Server -> General to enable built-in NS.
  3. Go to NetworkServer -> Applications to add an application, then click Save . 
  4. Add a transmission of data For this application, select MQTT as the type.

    Fill in the Tago MQTT broker information.

    • Broker address: mqtt.tago.io
    • Brokerage port: 1883
    • Customer ID: user defined
    • User credentials: enable
    • Username : Token
    • Password : device token copied from Tago UG65 device page

    For more information about the Tago MQTT broker, please refer to this page .

    Set an uplink post topic, in this example the topic is /mqtest

  5. Save all settings, then you can check the status of MQTT.

Step 2. Add a LoRaWAN® device to the gateway

Add the LoRaWAN® node to the Milesight gateway by referring to How to connect LoRaWAN nodes to Milesight Gateway . After login, you can check if the gateway is receiving data on the page Network server -> Packages .

Additionally, you can check if node data is sent to Tago.

Step 3. Separate Gateway Devices in Tago

Since an app can include multiple devices, Tago provides several steps below to split each device.

  1. Go to Integration -> Network to add a network. In this example, the network name is UG65 Network
  2. After creation, enable the setting Serial number and generate a network token, then save the settings.
  3. 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.
  4. Click here to install the analysis template Device Split Up and rename it. In this template you can find the sample code to define each device and upload each item to Tago. Please modify the tamplete code Const devaddr=scope[0].devaddr in Const devaddr=scope[0].devEUI . You can also modify the codes to define the information you should receive yourself.
  5. Copy the UG65 network token into environment variables , then save all the model settings.
  6. Go to the tab Action To add an action, select the type as MQTT Topic and the action like Run Analysis , then select the analysis you created.
    On the action page, select the UG65 gateway device and fill in the Uplink MQTT topic that you created in your Milesight gateway, then save all the settings.
  7. Go to the tab Device , select the network you created under My network , click on the EM300 connector to add a device.
    Enter the device's EUI as the serial number, then click Create my device .
  8. On this device page, you can only see the data download of this device.