Description

Niagara® is a building management system that utilizes an HTML framework to connect embedded devices or systems across a large number of manufacturers and communication protocols. This article will describe how to integrate Milesight LoRaWAN gateways to Niagara platform via MQTT protocol.

 

Requirement

  • Milesight LoRaWAN Gateway: UG56, UG65, UG67
  • LoRaWAN End Device: take AM308 as example
  • Niagara BMS Platform

 

Configuration

1. Add LoRaWAN Device to Gateway

Refer to How to Connect LoRaWAN Nodes to Milesight Gateway to add LoRaWAN end devices to gateway.


2. Create an MQTT Broker

If you already have a MQTT broker, please skip this step. Otherwise, you can create a temporary MQTT broker using Node-RED on the gateway.

Go to App > Node-RED page to enable Node-RED program and wait for a while to load the program, click Launch button to start Node-RED web GUI.

 

Log in the Node-RED web GUI. The account information is the same as gateway web GUI.

Click on the top right of the interface, go to Manage Palette to search for "node-red-contrib-aedes" and install it.

 

 

Add and configure a aedes broker node. You can keep all parameters by default.

Note that do not configure the MQTT port as 1883 which is used by gateway programs. In this example we use port 21883.

 

After save and Deploy, the MQTT broker is setup, which uses the same address as gateway, which is 192.168.45.213 in this example and the port number is 21883.

 

 

3. Gateway MQTT Configuration

Refer to the guide How to Connect LoRaWAN Gateway to MQTT Broker? to configure gateway to connect to the MQTT broker.

The MQTT address here is 192.168.45.213, the port number is 21883, and the Uplink Topic path is /milesight/uplink.


 

4. Add Node-RED Flow

Click Import button in the top right corner, and import the example flow at the end of this article.

 

Modify the "Filter AM308 Data" node's Device EUI as your AM308 device EUI, and keep the other settings as default. If you use other models, please refer to this flow example to adjust the reported format.

 Click Deploy to save the configurations. 

 


5. Connect Niagara to MQTT Broker

Navigate to Station > Config > Drivers > AbstractMqttDriverNetwork, drag and drop DefaultMqttDevice from the Palette window, renaming it to UG65-Remote-NS in this example.

 

Scroll down to the bottom of the page, find authenticator, expand it and type the MQTT broker Endpoint (address) and port, then click Save.

 

Next, right-click UG65-Remote-NS > Actions > Connect.

 

Check the Status Message. If it shows "Connected", Niagara platform has successfully connected to the MQTT broker.

 

 

6. Add MQTT Points in Niagara

Navigate to Station > Config, right-click to create a folder, and rename it to "MQTT Points".

 

Create two variables by double-clicking: one StringWritable and one NumericWritable. Name them MQTT_STRING and MQTT_NUMERIC respectively. The result should look like this:

 

Next, navigate to Station > Config > Drivers > AbstractMqttDriverNetwork, click on the Exts icon, click the Discover button, and drag MQTT_STRING down.

 

In the pop-up window, change the Type to MqttStringSubscribePoint (if you select the wrong type, data will not display), and set the Topic to /milesight/uplink, then click OK. Repeat this process for other points.

 

The final configuration is like this:

 

7. Subscribe to MQTT Broker Data

Navigate to Station > Config > Drivers > AbstractMqttDriverNetwork > UG65-Remote-NS:

 

Right-click Actions > Subscribe All. The subscribed data will be displayed as shown below:

 

8. Display Case

 

 

 

---END---