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 Modbus 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. Add Node-RED Flow
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 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.
Flow Introduction
The flow example consists of four modules from top to bottom:
Block 1: This module creates a Modbus Server with the address 0.0.0.0 and port 10502.
Block 2: This module initializes the values of virtual registers. I chose an initial value of 999 for all registers and added delays to prevent conflicts. The register addresses are 0 and 1.
Block 3: This module receives data from the AM308 sensor and decodes the device's payload, writing temperature and humidity into registers 0 and 1 respectively.
Block 4: This module is for manual debugging and testing purposes and can be ignored.
3. Add Modbus Server to Niagara
Navigate to Station > Config > Drivers > ModbusTcpNetwork, and click New button. In the popup, select "Modbus Tcp Device" from the "Type to Add" dropdown and click OK.
In the next popup, change the Name to UG65-Modbus-Server, modify the IP Address to the gateway's address and set the Port (in this example is 192.168.45.213 and 10502). After configuring, click OK.
4. Add Modbus Points in Niagara
On the same page, click the Exts icon to navigate to the Points interface.
Click the New button, and in the popup, select "Numeric Point" from the "Type to Add" dropdown list. Change "Starting Address" to "Decimal" and enter 0 for the address. Click OK.
In the next popup, change the Name to "Register-00" and leave the rest as default.
Repeat the steps to create more points different Starting Addresses for each Register, specifically 0 and 1. In this example we create two points. Make sure the Address corresponds exactly to the register addresses mentioned in the Node-RED flow.
After configuring, wait a moment and the relevant data should be displayed on the Out column. You can also configure the Facets parameter based on the data type.
5. Display Case
6. FAQ
Question: Why no data is displayed in the final Out interface after waiting for a long time?
Answer: After each Modbus Server restart, you need to manually reconnect Niagara. Please modify the “Enabled” setting by changing it to false and then save, and then change it back to true and save again.
---END---