(Optional) Add a LoRaWAN Interface (Beta) (Release 4.1 and Prior)

LoRaWAN devices are supported with SmartServer 4.0 and higher.

For SmartServer 4.2 and higher, see (Optional) Add a LoRaWAN Interface.

You can use the SmartServer to integrate and manage LoRaWAN (Long Range Wide Area Network) devices.  LoRaWAN is a low power, wide area (LPWA) networking protocol designed to wirelessly connect battery (class A) and line-powered (class C) devices to a network providing bi-directional communication, end-to-end security, mobility, and localization services. The SmartServer LoRaWAN driver sends and receives data to and from LoRaWAN devices via a LoRa Network Server (LNS), which in the case of SmartServer 4.0 and higher is ChirpStack 4.2. ChirpStack is not included with the factory SmartServer image and is added during the SmartServer LoRaWAN setup.

To set up and use LoRaWAN with the SmartServer, follow these steps:

  1. Add a LoRaWAN network interface as described on this page.

  2. Import, import and modify, or create a LoRaWAN device interface (XIF) and device type definition as described on this page.

  3. Define datapoint properties for any datapoints to be monitored or logged as described in Setting Datapoint Properties.

  4. Define or discover, and provision devices as described in Site Provisioning.

  5. To optionally provide a BACnet interface for your LoRaWAN device see Setting up the BACnet Server.  This enables you to use a BACnet workstation with your LoRaWAN device.

This page includes the following sections:

LoRaWAN Architecture

A typical LoRaWAN architecture is shown below:

Adding a LoRaWAN Network Interface

To set up the LoRaWAN driver (beta), contact the EnOcean Customer Success team at edge.support@enocean.com.

Once your system is set up for LoRaWAN, you can start adding your devices into ChirpStack and then provisioning them in the CMS once they are discovered. See the Adding LoRaWAN Devices in ChirpStack section in Discovering, Defining, or Importing Devices.

Upgrade warning

  1. For the beta release, once you have configured your SmartServer with the LoRaWAN image, do not upgrade or re-image the SmartServer as this operation breaks the LoRaWAN configuration.
  2. For the beta release, do not change the static IP address of the SmartServer as this operation may break ChirpStack.

Enabling / Disabling the LoRaWAN Driver

By default, support for the LoRaWAN driver is disabled. However, once the beta configuration has been set up, the LoRaWAN driver will be running. The information that follows regarding enabling/disabling the LoRaWAN driver is for your reference only.

Enabling the LoRaWAN Driver

To enable the LoRaWAN driver, first enter the following command:

For SmartServer 4.1 (Beta) (LoRaWAN Driver Beta)
sudo smartserverctl enable lorawan
For SmartServer 4.0 (LoRaWAN Driver Beta)
sudo smartserverctl enable smartserver-lwd

Then, start the LoRaWAN driver by rebooting the SmartServer or by issuing the following command:

For SmartServer 4.1 (Beta) (LoRaWAN Driver Beta)
sudo smartserverctl start lorawan
For SmartServer 4.0 (LoRaWAN Driver Beta)
sudo smartserverctl start lwd

Disabling the LoRaWAN Driver

To disable the LoRaWAN driver, you first need to stop the driver. Issuing only the disable service command does not stop the service from running. The service will continue to run and will only be stopped after a reboot or by issuing the stop command as well. To stop and disable the LoRaWAN driver, enter the following commands:

For SmartServer 4.1 (Beta) (LoRaWAN Driver Beta)
sudo smartserverctl stop lorawan
sudo smartserverctl disable lorawan
For SmartServer 4.0 (LoRaWAN Driver Beta)
sudo smartserverctl stop lwd
sudo smartserverctl disable lwd

Importing and Creating LoRaWAN Device Interface (XIF) and Device Type Definitions

You can import and optionally modify LoRaWAN device interface (XIF) and device type definitions.  You can also manually create custom LoRaWAN XIF and device type definitions.  To import and modify LoRaWAN device interface (XIF) and device type definitions, follow these steps:

  1. To import LoRaWAN XIF definitions, download the LoRaWAN device type package (.dtp) files from the SmartServer GitHub Repository  You can optionally modify the LoRaWAN XIF files to hide selected datapoints.

  2. To create a custom LoRaWAN XIF definition (.LoRaWAN), see Creating a LoRaWAN Device Interface (XIF) Definition (Beta).

  3. To create a custom LoRaWAN device type definition (.dtd), see Defining Device Types.

  4. Import the LoRaWAN device interface (XIF) and device type definitions using the Import / Export button () on the SmartServer app bar.

Receiving Uplink Data from Edge Devices

LoRaWAN devices will send unconfirmed uplink data regularly, along with alarm data as necessary. Regular uplink data may consist of one or more packets, separated by a few seconds. The regular update interval is configurable either using an NFC app or via downlink data and determines battery life for class A devices. Devices send an encrypted base64-encoded hex string over the air that represents all the sensor data, the LNS decrypts the data, converts from base64-encoded to a hex string and the relevant device profile codec converts the hex string to JSON which is passed to IAP using MQTT. The entire hex string prior to JSON encoding is available in IAP.

Sending Downlink Data to Edge Devices

The LoRaWAN driver sends downlink data to the LNS using MQTT. The LNS forwards the data to edge devices. The LoRaWAN driver uses an LNS-specific MQTT topic, base64-encoded data, and the fport number configured in the XIF for the device type and the datapoint in question. The data is sent to the LoRaWAN device using a confirmed message. Downlink data may relate to a specific datapoint, or may be a hex string that can be used to configure the regular uplink period, alarm thresholds or form part of a request response mechanism in conjunction with the subsequent uplink data.

Defining the IAP Device UNID

The LoRaWAN device DevEUI is used as the IAP unid. It is either acquired when using automatic discovery for LoRaWAN (the preferred mechanism) or added when manually creating devices.

Using Redundant LoRaWAN Gateways

ChirpStack supports redundant gateways, either for enhanced coverage or for true redundancy.

Configuring the LoRaWAN Gateway

ChirpStack requires an external LoRaWAN gateway that must be configured for Semtech Packet Forwarding on UDP port 1700 (Up and Down) and the LNS IPV4 address set to that of the SmartServer.

An example RAK gateway configuration is shown below. Make a note of the Gateway EUI for subsequent use.