LoRaWAN Driver (Milesight) for Tridium Niagara 4

Technical Guide

Date: 14/08/2024 | Revision: 1.2

Published by Tyrrell Products Ltd

Introduction

The LoRaWAN Driver can be used to provide a fast and simple interface to a LoRaWAN based system of devices. The driver can be used from any Niagara Station (Web Sup / JACE / 3rd Party Controller) to a Milesight LoRaWAN Gateway (such as UG65). This includes Milesight Gateways on a local LAN or via a remote cellular connection.

The driver is designed to simplify the integration of LoRaWAN networks into Niagara without having to manually setup and decode JSON payloads. The driver will support 'known' devices and also support new / unknown devices.

The connection to the LoRaWAN Gateway is bidirectional over a HTTP interface.

The Driver is compatible with all brands of Niagara 4 (Tridium / Centraline / Distech / Honeywell / JCI / Trend etc).

Supported Platforms

The LoRaWAN Driver can be used in several different scenarios on different Tridium Niagara based platforms via a Milesight Gateway:

  • Web Supervisor
  • JACE8000 / JACE9000
  • Any 3rd Party Controller (IoT Controller / Lynxspring / iSMA MAC36 etc).

Example Scenarios

Example 1: Web Supervisor - Milesight UG65 Gateway (Local LAN)

Diagram: A Niagara 4 Web Sup icon is shown connected via a 'Local LAN' line to a Milesight UG65 gateway. The gateway has a wireless antenna symbol and is connected wirelessly to 'LoRa Devices' represented by various geometric shapes.

The Web Supervisor integrates directly to the local Milesight UG65 Gateway. All configured LoRaWAN devices will be discoverable in the Niagara Station and their enclosed points will also be discoverable.

Example 2: Niagara Enabled Controller - Milesight UG65 Gateway (Local LAN)

Diagram: A TRIDIUM JACE8000 / JACE9000 icon is shown connected via a 'Local LAN' line to a Milesight UG65 gateway. The gateway has a wireless antenna symbol and is connected wirelessly to 'LoRa Devices' represented by various geometric shapes.

The JACE8000 / 3rd Party Controller integrates directly to the local Milesight UG65 Gateway. All configured LoRaWAN devices will be discoverable in the Niagara Station and their enclosed points will also be discoverable.

Example 3: Cloud Based Niagara 4 - Remote Milesight UG65 Gateway (Cellular)

Diagram: A cloud icon labeled 'niagara4' (Cloud Based Niagara 4) is shown communicating wirelessly with a 'Milesight UG65 Cellular Enabled' gateway. The gateway also has a wireless antenna symbol and communicates wirelessly with 'LoRa Devices' represented by various geometric shapes.

The Web Supervisor integrates remotely to the remote Milesight UG65 Gateway (with integrated SIM card). All configured LoRaWAN devices will be discoverable in the Niagara Station and their enclosed points will also be discoverable.

Licensing & Software Maintenance

The LoRaWAN driver is licensed based on points. Each LoRaWAN point will also consume one Global Capacity Point License.

You will need to provide your Niagara 4 Host ID as part of your purchase. If you are expanding your system in the future you will need to ensure that your LoRaWAN Driver has been expanded to cover the number of new points being added.

Once the license has been generated you can re-import your Niagara license files from the Platform > License Manager providing you have an internet connection, alternatively you can be emailed a copy of the new license files.

The LoRaWAN Driver includes a software maintenance feature. Every new purchase of the driver will support the current release of Niagara 4 and the next release of Niagara 4; any subsequent upgrades will require a software maintenance license to be purchased.

As an example, the current release of Niagara 4 is N4.13. A new driver purchase will cover you for N4.13 and a future upgrade to N4.14. Any further upgrades, for example to N4.15 or above, will require a software maintenance license to be updated. The software maintenance license would then cover you for the now current release of Niagara 4 (as an example N4.15). You can upgrade from any previous release with a single software maintenance purchase.

Ensure the target Host License Manager is up to date with a Tyrrell.license and Tyrrell.certifcate containing the required license features.

Any questions or queries in relation to this item should be sent to sales@tyrrellproducts.com.

LoRaWAN Driver License Packs

Product Code Description
LoRaWAN 0025 LoRaWAN Driver 25 Point License Pack
1x LoRaWAN Network
25x LoRaWAN Points
LoRaWAN 0050 LoRaWAN Driver 50 Point License Pack
1x LoRaWAN Network
50x LoRaWAN Points
LoRaWAN 0100 LoRaWAN Driver 100 Point License Pack
1x LoRaWAN Network
100x LoRaWAN Points
LoRaWAN 0250 LoRaWAN Driver 250 Point License Pack
1x LoRaWAN Network
250x LoRaWAN Points
LoRaWAN 0500 LoRaWAN Driver 500 Point License Pack
1x LoRaWAN Network
500x LoRaWAN Points

LoRaWAN Driver Upgrade Packs

Product Code Description
LoRa0025-UPG 25x LoRaWAN Points
LoRa0050-UPG 50x LoRaWAN Points
LoRa0100-UPG 100x LoRaWAN Points
LoRa0250-UPG 250x LoRaWAN Points
LoRa0500-UPG 500x LoRaWAN Points

Driver Installation

The LoRaWAN Driver supports Niagara 4.10 and above.

NOTE: If your installation is running an older version of the Niagara software, then it must be upgraded to meet the above requirements to run this service.

Any future updates to the LoRaWAN Service will be available for the current release and previous Niagara 4 release. All other releases will become legacy and unsupported.

Niagara 4 Installation:

You will need the version-specific JAR files for your Niagara 4 installation. These can be downloaded from the Customer Portal or alternatively contact support.

To install the Service, copy the below JARs to c:\niagara\niagara 4.x.xx\modules:

  • LoRaWAN-rt.jar
  • LoRaWAN-wb.jar

Once the files have been put into the correct directory, close your workbench and relaunch. Any running Stations on the local machine will have to be re-started to make use of the LoRaWAN Driver.

The LoRaWAN Driver is now ready to use in a local station or to commission / update a JACE. To install the driver on a JACE, use the Commissioning Wizard on the platform of the target device.

Milesight Setup

The Milesight Gateway will need to have a specific configuration applied:

  • Create An Application(s)
  • Assign LoRaWAN Devices to the Application(s)

The integration between Niagara 4 and Milesight gateway will support HTTP connections only. This is a current limitation of the Milesight Gateways.

Milesight Applications

Login to your Milesight Gateway (the default details are printed on the rear of the unit). Navigate to Network Server > Applications.

Screenshot: Milesight Gateway interface showing the Network Server menu on the left. The 'Applications' tab is selected in the main panel. A table shows existing applications (e.g., 'TestAp').

Create a new Application and save it.

Screenshot: Milesight Gateway interface showing the 'Applications' form. Fields include 'Name' (set to 'Niagara 4'), 'Description' (set to 'Niagara 4 Connection'), and 'Data Transmission' with 'Type' set to 'HTTP' and an 'Operation' button.

Operation - HTTP Configuration

Re-edit the Application and configure a new Operation - HTTP.

Edit the Uplink Data field to be http://IPADDRESS/lorawan/noAuthListener/uplink.

Where IPADDRESS is the address of your Niagara 4 Station. Example: http://192.168.23.10/lorawan/noAuthListener/uplink

Screenshot: Milesight Gateway interface showing the 'Operation - HTTP' configuration for an application. The 'URL' field is visible, with an example value like 'https://192.168.23.150/wan'.

Save both the Operation and Application, then return to the main menu.

LoRaWAN Sensors

Before configuring the Niagara Station, you will need to ensure that your Milesight Gateway is paired with at least one LoRaWAN Device.

You may require a dedicated Mobile Phone App to configure the sensor; this guide will demonstrate an Elsys sensor.

Download the Sensor App onto your Mobile Device.

Note: Your mobile device must be fitted with an NFC chip to work.

Screenshot: A mobile phone screen displaying a sensor configuration app. It shows a device UID 'a81758fffe05d501', a dropdown for 'Sensor' (showing 'ERS Co2'), a 'Timebase' field set to '300', and buttons for 'Sample times', 'Sensor keys', 'LoRaWan configuration', 'Extended LoRaWan', 'WRITE', and 'READ'.

Make note of the Sensor UID (e.g., a81758fffe05d501).

Adding a Device in Milesight Gateway

In the Milesight Gateway, navigate to Network Server > Device.

Add a new Device.

Screenshot: Milesight Gateway interface showing the 'Add a new Device' form. Fields include 'Device Name', 'Description', 'Device EUI', 'Device-Profile' (e.g., 'ClassA-OTAA'), 'Application' (e.g., 'Niagara4'), 'Payload Codec' (e.g., 'None'), 'fPort', 'Frame-counter Validation', 'Application Key', 'Device Address', 'Network Session Key', 'Application Session Key', 'Uplink Frame-counter', and 'Downlink Frame-counter'.

Setting Description
Device Name Unique Name of the Device
Description User Friendly Description
Device EUI From the Sensors App
Device Profile From Spec Sheet Of Device
Application Your Custom Application in the previous step
Payload Codec None By Default
App Key Can be changed for new / unknown devices (see later section). From the Sensors App. Milesight Default is: 5572404c696e6b4c6f52613230313823

Device Active Check

Once you have added a device, ensure it is active and sending data before proceeding. Once working, the Last Seen and Activated fields will update.

Screenshot: Milesight Gateway interface showing the 'Device' list. It displays columns for 'Device Name', 'Device EUI', 'Device-Profile', 'Application', 'Last Seen', 'Activated', and 'Operation'. The device 'Elsys 3in1' is listed as active.

Niagara Web Service Configuration

Connect to your Niagara 4 Station.

Navigate to Station > Services > Web Service.

Set the HTTP option to TRUE and ensure HTTPS ONLY is set to FALSE.

Screenshot: Niagara 4 Station interface showing the 'Web Service' configuration. Options include 'Status', 'Enabled' (set to true), 'Http Port' (80 tcp), 'Http Enabled' (set to true), 'Https Port' (443 tcp), 'Https Enabled' (set to true), and 'Https Only' (set to false).

LoRaWAN Driver Configuration

Navigate to Station > Config > Drivers and add a new LoRaWAN Driver.

Navigate to the AX Property Sheet view of the Network.

Screenshot: Niagara 4 Station interface showing the property sheet for a 'LoRaWANNetwork'. Fields include 'Status' (down), 'Enabled' (true), 'Fault Cause', 'Health', 'Alarm Source Info', 'Monitor', 'Tuning Policies', 'Network Server Type' (set to 'None'), and 'Network Server' (set to 'Null Network Server').

Change the Network Server Type to Milesight UG65.

Network Server Configuration

Expand the Network Server Section.

Screenshot: Niagara 4 Station interface showing the expanded 'Network Server' section within the LoRaWAN Driver property sheet. Fields include 'URL', 'Username', and 'Password'.

Note: The user account MUST be the admin account.

Setting Description
URL IP of the Milesight Gateway (e.g., http://192.168.23.150)
Username admin
Password Admin account password

Device Manager

Navigate to the LoRaWAN Driver > Device Manager and press Discover.

The driver will then discover all available devices from the Milesight Gateway.

Screenshot: Niagara 4 Station interface showing the 'Lorawan Discovery' window. It lists discovered devices with columns for 'Device Name', 'Device Eui', 'Description', and 'Last Seen'. The device 'Elsys 3in1' is shown.

Add the required device(s) to the Station database.

Adding a Device - Device Type Configuration

When adding a device, the Add Window will have a Device Type option. The driver has a pre-configured library of devices that will automatically 'work'. New / Unknown devices can still be added but need to be set with a 'Generic' profile and the JSON payload decode. Refer to the section Supported Devices for more information.

Screenshot: Niagara 4 Station 'Add' window for a device. It shows fields for 'Name', 'Type', 'Device Eui', and 'Device Type'. The 'Device Type' dropdown is open, showing a list of supported devices including 'ELSYS CO2 Lite' and 'Generic (pre-decoded JSON)'.

Once the device has been added, navigate to the Points container of the device.

Point Discovery

In the Point Manager Window, press the Discover button, and all available points will be presented.

Screenshot: Niagara 4 Station interface showing the 'Lorawan Discovery' window for points. It lists discovered points with columns for 'Point Name', 'Display Name', 'Point Type', 'Json Field', 'Device Facets', and 'Point Facets'. A 'Database' table below shows points with their 'Name', 'Type', 'Out', 'Enabled', 'Device Facets', and 'Json Field'. Initially, points show '{stale}' status.

Add the required Points to the Station Database.

The Points will all remain STALE until the LoRaWAN sensor next reports to the Gateway. Check the device configuration and either wait for the next publish cycle or change the device's config to report more frequently during setup.

Screenshot: Niagara 4 Station interface showing the 'Database' table of points with updated values. Points now show '{ok}' status, indicating data has been received.

The points will then only update their values when the LoRaWAN sensor reports to the LoRaWAN Gateway (for example, every 5 mins).

Supported Devices

The LoRaWAN driver automatically supports the following device types:

  • Adonis Pulse Counter: 2x Configurable Pulse Counter Inputs
  • B Meters RFM-LR1: For pre-equipped single jet water meters
  • ElSys CO2 Lite (3 in 1): Temp / Hum / CO2
  • Milesight AM102L: Temp / Hum
  • Milesight AM103L: Temp / Hum / CO2
  • Milesight AM307: 7 in 1 Sensor (Temp / Hum / Motion / Light / TVOC / Barometric Press / CO2)
  • Milesight AM308: 9 in 1 Sensor (Temp / Hum / Motion / Light / TVOC / Pressure / CO2 / PM2.5 / PM10)
  • Milesight AM319: 11 in 1 Sensor (Temp / Hum / Motion / Light / TVOC / Pressure / CO2 / PM2/5 / PM10 / (HCHO)² / (O3)²)
  • Milesight EM300 DI: Temp / Hum / DI or Pulse Counter
  • Milesight EM300 MCS: Temp / Hum / Magnetic Switch
  • Milesight EM300 SLD/ZLD: Temp / Hum / Leak Detection
  • Milesight EM300 TH: Temp / Hum
  • Milesight TS101: Insertion Temp
  • Milesight TS201: Flying Lead Temperature Probe
  • Milesight TS301: 1x Connector for PT100 Sensor OR Magnetic Switch
  • Milesight TS302: 2x Connector for PT100 Sensor OR Magnetic Switch
  • Milesight UC300: IO Controller (4* DI / 2* DO / 2* 4-20mA / 2* 0-10v / 2* PT100 Sensor) - *RS485 NOT CURRENTLY SUPPORTED!
  • Milesight VS350: Passage People Counter
  • Milesight WT101* (In Development): Smart Radiator Thermostat

Other devices are supported in one of two ways:

  • Use the 'Generic' profile and decode the incoming JSON.
  • For Sensor/Device Types that are not listed in the LoRaWAN Niagara driver, please ask Tyrrell Products Ltd about adding your LoRaWAN Device type to the driver's drop-down list.

This will greatly simplify the process of adding devices in the future.

LoRaWAN Device Payload De-coding

New / unknown LoRaWAN device types can still be supported by using the “Generic (pre-decoded JSON)” Device Type drop-down list option in combination with some modifications to the device manufacturer supplied JavaScript “Payload Decoder Function”.

This example will cover a EM300-TH.

You will need the manufacturer's decoder script.

As an example:

https://github.com/Milesight-IoT/SensorDecoders/blob/main/EM_Series/EM300_Series/EM300-TH/EM300-TH_Chirpstack.js#L1

JavaScript Decoder Example

Original Example:

/**
* Payload Decoder for Milesight Network Server
*
* Copyright 2023 Milesight IoT
*
* @product EM300-TH
*/
function Decode(fPort, bytes) {
    return milesight(bytes);
}

function milesight(bytes) {
    var decoded = {};
    // ... rest of original code
    return decoded;
}

Modified Example:

/**
* Payload Decoder for Milesight Network Server
*
* Copyright 2023 Milesight IoT
*
* @product EM300-TH
*/
function Decode(fPort, bytes) {
    var decoder = {};
    decoder.devEUI = LoRaObject.devEUI;
    decoder.dataJson = milesight(bytes);
    decoder.time = LoRaObject.time;
    return decoder;
}

function milesight(bytes) {
    var decoded = {};
    // ... rest of modified code
    return decoded;
}

Information:

The entry decoder.dataJson = milesight(bytes); must match up with the next section line function milesight(bytes).

Once modified, copy the whole of the JS to Notepad++ and modify the first part. Then paste the modified copy into the Milesight gateway.

Custom Payload Codec Configuration

Open the Milesight Web Server and login.

Navigate to Network Server > Payload Codec.

Add a new Custom Payload Codec.

Screenshot: Milesight Gateway interface showing the 'Custom Payload Codec' form. Fields include 'Name' (e.g., 'JSON Codec EM300'), 'Description' (e.g., 'Test EM300-TH'), 'Template' (set to 'None'), and 'Payload Decoder Function'. The 'Payload Decoder Function' field contains JavaScript code.

Paste the modified JSON into the Payload Decoder Field.

Save the custom codec.

Device Payload Codec Update

Navigate to Network Server > Device.

Edit the Device in question.

Change the Payload Codec from None to JSON Codec EM300 (or appropriate Codec Name).

Screenshot: Milesight Gateway interface showing the 'Edit Device' form. The 'Payload Codec' field is visible and set to 'JSON Codec EM300'. Other fields like 'Device Name', 'Device EUI', 'Application Key', etc., are also shown.

Save and Apply the change.

Niagara Generic JSON Configuration

Return to the Niagara Station and discover the LoRaWAN devices.

Add the target device handset; set the Device Type to Generic (pre-coded JSON).

The Point Discovery will not work, and the points will have to be manually programmed based on their JSON payload names. These can all be obtained from the Payload Decoder.

Screenshot: Niagara 4 Station interface showing an 'Edit' window for a point, configured as 'Generic (pre-coded JSON)'. Fields include 'Name', 'Type', 'Facets', 'Fault Cause', 'Enabled', 'Device Facets', 'Tuning Policy Name', 'Read Value', 'Write Value', and 'Json Field'. The 'Json Field' is shown as 'temperature'.

In the above example, the JSON Field is temperature.

The Name and Facets can be configured as required based on the point type.

The next time the LoRaWAN device reports to the Gateway, the points will update their values.

Revision History

Revision Description
1.0 Draft Release For Approval
1.1 General Update
1.2 List of Automatically Supported Devices Expanded
Models: UG65 Lora Wan Niagara 4 Driver, UG65, Lora Wan Niagara 4 Driver, Wan Niagara 4 Driver, Niagara 4 Driver, 4 Driver

File Info : application/pdf, 31 Pages, 1,023.97KB

PDF preview unavailable. Download the PDF instead.

LoRaWAN-Driver-User-Guide-Rev1.2

References

macOS Version 14.3.1 (Build 23D60) Quartz PDFContext Pages