Skip to main content

LoRaWAN

The LoRaWAN I/O Server implements both a LoRaWAN Network and Application servers for the integration of a LoRaWAN network.

HSYCO acts as a server for one or more LoRaWAN gateways configured as standard Semtech packet forwarders. Communication is carried on UDP packets.

The implementation complies with the Semtech's packet forwarder protocol v4.0.1 and supports Class A and Class C end devices, using unconfirmed data frames and ABP authentication.

HSYCO Configuration

Add a LORAWAN I/O Server in the I/O Servers section of the Settings and set its parameters:

note

Only one instance of the LORAWAN I/O Server is allowed and it consumes one item for each defined gateway from the I/O Servers license total.

High Availability

  • Shutdown when inactive: defaults to true.

Options

IDDefaultValuesDescription
localport1700<port_number>the IP port number used locally by HSYCO to listen for incoming UDP packets sent by the gateways
downlinkpower2...20default power value for downlink frames (attribute "txpk" > "powe")
debugfalsetrueprint debugging information to the logs
falsedon't print debugging information to the logs

LoRaWAN Utility

Use the LoRaWAN Utility to automatically discover gateways and devices and setup communication and functional parameters.

Gateways Configuration

The LoRaWAN gateway(s) that will be used need to be configured to forward the received device data frames to HSYCO.

To this end, configure the gateway(s) as standard Semtech packet forwarder(s). Make sure the network configuration allows for the communication with HSYCO and use HSYCO's IP address and the port number specified in the "localport" option for the network server's configuration.

Datapoints

When no gateway nor device is configured, the LoRaWAN I/O Server starts in automatic discovery mode. Datapoints are created for all discovered gateways and devices; the <id> portion of the datapoints is set to the MAC address for gateways and to the LoRaWAN address for devices.

After configuration through the LoRaWAN Utility, datapoints will be generated only for defined gateways and devices. To re-enable discovery it must be done manually from the utility.

IDValueR/WDescription
connectiononlineRready to receive packets
offlineRnot ready
gw.<id>.lastseen<ts>Rtimestamp of the last packet received from gateway <id>
gw.<id>.lastpull<ts>Rtimestamp of the last "pull data" packet received from gateway <id>
gw.<id>.stat.time<time&gtRUTC system time reported in the latest status message from gateway <id>
gw.<id>.stat.lati<n>RGPS latitude in degree (float, N is +) reported in the latest status message from gateway <id>
gw.<id>.stat.long<n>RGPS longitude in degree (float, E is +) reported in the latest status message from gateway <id>
gw.<id>.stat.alti<n>RGPS altitude in meter reported in the latest status message from gateway <id>
gw.<id>.stat.rxnb<n>Rnumber of radio packets received reported in the latest status message from gateway <id>
gw.<id>.stat.rxok<n>Rnumber of radio packets received with a valid PHY CRC reported in the latest status message from gateway <id>
gw.<id>.stat.rxfw<n>Rnumber of radio packets forwarded reported in the latest status message from gateway <id>
gw.<id>.stat.ackr<n>Rpercentage of upstream datagrams that were acknowledged reported in the latest status message from gateway <id>
gw.<id>.stat.dwnb<n>Rnumber of downlink datagrams received reported in the latest status message from gateway <id>
gw.<id>.stat.txnb<n>Rnumber of packets emitted reported in the latest status message from gateway <id>
dev.<id>.lastseen<ts>Rtimestamp of the last packet received from device <id>
dev.<id>.data<bytes>RHexadecimal representation of the data transmitted in the last valid packet received from device <id>. E.g.: "010fbb"
dev.<id>.data.ch<n><val>RCayenne channel <n>'s value. Possible values depend on the channel's type, refer to Cayenne LLP format for details. Datapoint available only if Cayenne data format is enabled on this device
dev.<id>.data.ch<n>.type<t>RCayenne channel <n>'s type. Refer to Cayenne LLP format for details. Datapoint available only if Cayenne data format is enabled on this device
WSet Cayenne channel <n>'s type. To be used to write output channels for which no data has been received. Possible values are "1" (digital output) or "3" (analog output). Datapoint available only if Cayenne data format is enabled on this device
dev.<id>.fcnt.up<n>Rserver-side uplink frame-counter for device <id>. Used for frames validation. If never set and no frame has ever been received it is set to -1
Wset the server-side downlink frame counter for device <id>
dev.<id>.fcnt.down<n>Rvalue of the last frame counter used to send a downlink to device <id>. If never set o no frame has ever been sent it is set to -1
Wset the downlink frame counter for device <id>
dev.<id>.datrSF<sf>BW<bw>RData rate of last valid packet received from device <id>. <sf> ranges from 7 to 12 and <bw> is either 125, 250 or 500. E.g.: "SF7BW125"
dev.<id>.codr<cr>RCoding rate of last valid packet received from device <id>. Possible <cr> values: "4/5", "4/6", "4/7", "4/8"
dev.<id>.freq<fr>RTX central frequency in MHz (float, Hz precision) of last valid packet received from device <id>
dev.<id>.lsnr<val>RLoRa SNR ratio in dB (float, 0.1 dB precision) of last valid packet received from device <id>
dev.<id>.rssi<val>RRSSI in dBm (signed integer, 1 dB precision) of last valid packet received from device <id>
dev.<id>.tmst<val>Rgateway internal timestamp of the instant the last valid frame from device <id> was received
dev.<id>.gw<gw_id>RID of the gateway from which the latest packet from device <id> was received
dev.<id>.warning.data0Rthe latest uplink frame from device <id> has been decoded correctly
1Rerror decoding the latest uplink frame from device <id>
dev.<id>.warning.fcnt0Rthe frame counter in the latest uplink frame from device <id> was valid
n >= 10Rthe frame counter in the latest uplink frame from device <id> was not valid (n = 10: repetition)
dev.<id>.warning.mic0Rthe message integrity code (MIC) in the latest uplink frame from device <id> was valid
1Rthe message integrity code (MIC) in the latest uplink frame from device <id> was not valid
dev.<id>.queue<data>Wadd a frame with the specified data (hexadecimal representation, e.g. "010fbb") to the downlink queue of device <id>, using the default transmission parameters.
<JSON>Wadd a frame with the specified data and transmission parameters to the downlink queue of device <id>. See [[#Downlink frame JSON format]] for details
clearWclear the downlink queue of device <id>
dev.<id>.queue.ch<n><val>Wadd a frame to the downlink queue of device <id> with Cayenne-encoded data for setting channel <n> to <val>. Possible values depend on the channel's type. Make sure the channel's type is set before writing this datapoint. The packet will be sent using the default transmission parameters. Datapoint available only if Cayenne data format is enabled on this device
dev.<id>.queue.size<n>Rnumber of downlink frames in the device's queue
dev.<id>.error.txNONERlast downlink for device <id> was sent correctly to the gateway
<err_code>Rthe gateway responded with the reported error code to the last downlink request for device <id>. Possible values are "TOO_LATE", "TOO_EARLY", "COLLISION_PACKET", "COLLISION_BEACON", "TX_FREQ", "TX_POWER", "GPS_UNLOCKED"
dev.<id>.error.data0Rdata in the last frame received from device <id> was processed correctly. Datapoint available only if Cayenne data format is enabled on this device
1Rerror processing data in the last frame received from device <id>. Datapoint available only if Cayenne data format is enabled on this device

Datapoint dev.<id>.queue accepts as value a JSON object with the following attributes:

  • data: hexadecimal representation of the data bytes (as string) or JSON object with Cayenne fields:
    • channel: Cayenne channel number
    • type: Cayenne channel type
    • value: Cayenne channel value
  • port: port number to send the data to
  • attempts: number of attempts made to deliver the frame to the gateway before discarding it
  • txpk: JSON object with the metadata fields to include in the downlink packet:
    • codr: Coding rate
    • datr: Data rate
    • powe: Power
    • rfch: RF chain
    • For additional fields see here

Other than "data", all additional attributes are optional. When not specified, default values, based on the device's settings and on the last received packet, will be used .

Example 1 (spaces added for readability):

{
"data": "aa330b",
"port": 7,
"attempts": 5,
"txpk" : {
"codr": "4/5",
"powe": 14,
"datr": "SF7BW125",
"rfch":0
}
}

Example 2:

{
"data": "020304aa330bff",
"port": 5

}

Example 3:

{
"data": {
"channel": 6,
"type": 3,
"value": 23.14
},
"attempts": 2
}

Cayenne LLP format

Type valueType descriptionValue format
0digital input0 or 1
1digital output0 or 1
2analog inputsigned decimal number with 0.01 resolution
3analog outputsigned decimal number with 0.01 resolution
101illuminance sensorinteger value in Lux
102presence sensor0 or 1
103temperature sensorsigned decimal value in °C with 0.1 resolution
104humidity sensorunsigned decimal value in % with 0.5 resolution
113accelerometer[x, y, z] where x, y and z represent the acceleration on each axis. They are signed decimal values in G with 0.001 resolution
115barometerunsigned decimal value in hPa with 0.1 resolution
134gyrometer[x, y, z] where x, y and z represent the rotation on each axis. They are signed decimal values in °/s with 0.01 resolution
136GPS location[latitude, longitude, altitude] where latitude and longitude are signed decimal values in ° with 0.0001 resolution and altitude is a signed decimal value in meters with 0.01 resolution

Release Notes

3.8.0

  • added "downlinkpower" I/O server option
  • fixed license limits check when I/O server restarts
  • fixed bug affecting devices with disabled frame-counter validation upon uplink counter roll-over

3.7.0

  • initial release

LoRaWAN is a registered trademark of LoRa Alliance.

Semtech is a registered trademark of Semtech Corporation.