Downlink
Once a downlink message is transmitted to the end device, the NS generates a message with type=downlink
and sends this message to the AS.
Please note the these messages could not be used to actually send downlink messages to end devices. It is generated only to notify the AS that a downlink has been successfully sent by the NS.
In order to initiate a downlink message to a device, please read the downlink_request section carefully.
The NS allows you to optionally add information about MAC commands to the downlink message: add lora=1
parameter to the query string.
For example:
wss://ns.eu.everynet.io/api/v1.0/data?access_token=9ec85978f3fa1ab6f953406269f69a95&lora=1
For a better understanding of the message flow, please refer to this sequence diagram:
In other words, the following sequence is taking place:
- The Device transmits a confirmed uplink message and waits for acknowledgment from the network server.
- The NS receives an uplink message from the device, processes it and sends
uplink
anddownlink_request
messages to the AS. - The AS receives
uplink
anddownlink_request
messages, but it has nothing to send back to the device. - The NS builds a downlink message for the device and sends it in order to acknowledge confirmed uplink.
- The NS sends a
downlink
message to the AS in order to notify about a downlink message to the device.
Params
Message of type downlink
has the following fields:
Name | Description |
---|---|
counter_down | integer, downlink counter from LoraWAN packet, required |
port | integer, FPort from LoraWAN packet, required |
payload | string, optional, message (BASE64-encoded, plain). Use this in case of app_key is provided to Network. Encryption will be provided by Network. |
encrypted_payload | string, required, FRMPayload, message (BASE64-encoded, encrypted). Use this in case of Application Server is performing encryption procedure. |
duplicate | boolean, if the message is duplicate then this flag is true, required |
radio | object, required, includes radio information about hardware, modulation, frequency |
radio.freq | float, central frequency in MHz (unsigned float, Hz precision), required |
radio.time | float, unixtime, time of receiving the message at the gateway, optional |
radio.modulation | object, information about modulation, required |
radio.modulation.type | string, required, type of modulation, enum: LORA, FSK |
radio.modulation.coderate | string, LoRa ECC coding rate identifier, required |
radio.modulation.spreading | integer, required, spreading factor of LoRa message |
radio.modulation.bandwidth | integer, required, bandwidth of LoRa message |
radio.hardware | object, information about hardware, required |
radio.hardware.tmst | integer, send packet on a certain timestamp value (will ignore time), required |
radio.hardware.channel | integer, concentrator IF channel used for RX (unsigned integer), required |
radio.hardware.chain | integer, concentrator 'RF chain', required |
radio.hardware.status | integer, CRC status: 1 = OK, -1 = fail, 0 = no CRC, required |
Example
{
"meta": {
"network": "75697b95",
"packet_hash": "79f664df2c2073af798fa87497305d8d",
"application": "70b3d54b17db0106",
"device_addr": "36c365b4",
"time": 1504806731.759066,
"device": "faa73111a2aead2c",
"packet_id": "fdbb09021c4523d9f28bb815ca872c70",
"gateway": "7c95bd79864622a4",
"history": true
},
"params": {
"radio": {
"modulation": {
"bandwidth": 125000,
"type": 0,
"coderate": "4/7",
"spreading": 12,
"inverted": true
},
"hardware": {
"status": 1,
"chain": 0,
"power": 14.0,
"tmst": 515586002,
"channel": 0
},
"freq": 868.1,
"datr": "SF12BW125",
"time": 1504806732.249041
},
"payload": "YLRlwzaHRwAEAAUA0q2EFHt7NA==",
"port": 0,
"counter_down": 71
},
"type": "downlink"
}