6020 - P20 002 - Communication Protocol NEON Temperature Transmitter - C
6020 - P20 002 - Communication Protocol NEON Temperature Transmitter - C
Communication Protocol
Version C
05-03-2021
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C By: ML, TB, ZZ
Contents
1 General 2
2 Message Schemes 2
2.1 Activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Application Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 Device Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.4 Deactivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 Message Overview 5
3.1 Message Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4 Decoding/Encoding 6
5 Message Header 7
5.1 JSON Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5.2 Binary encoding and description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6 Uplink Messages 8
6.1 Boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.1.1 JSON Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.1.2 Binary encoding and description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.2 Activated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6.2.1 JSON Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6.2.2 Binary encoding and description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6.3 Deactivated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.3.1 JSON Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.3.2 Binary encoding and description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.4 Application Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.4.1 JSON Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.4.2 Binary encoding and description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.5 Device Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.5.1 JSON Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.5.2 Binary encoding and description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
7 Downlink Messages 17
7.1 Device Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.1.1 JSON Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.1.2 Binary encoding and description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.1.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
7.2 Application Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.2.1 JSON Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.2.2 Binary encoding and description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
7.2.3 Binary encoding and description Temperature event config . . . . . . . . . . . . . . . . . . . . . . 24
7.2.4 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
7.3 Configuration CRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
7.3.1 CRC Calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 1 of 28
2 MESSAGE SCHEMES
1 General
All variables are little endian.
2 Message Schemes
2.1 Activation
Activation of the Temperature Transmitter is initiated by the operator. After activation an Activation Message is sent.
The full sequence is depicted below.
In case of an error during activation, the procedure is aborted. The error situations can be as followed (see numbers
in diagram):
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 2 of 28
2 MESSAGE SCHEMES
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 3 of 28
2 MESSAGE SCHEMES
2.4 Deactivation
The operator can deactivate by a long press of the button. This will result in a Deactivation Message.
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 4 of 28
3 MESSAGE OVERVIEW
3 Message Overview
3.1 Message Overview
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 5 of 28
4 DECODING/ENCODING
4 Decoding/Encoding
The messages are sent over LoRa in a binary bytestring. A LoRa network server can decode raw bytestrings coming
from the LoRa devices into JSON objects. It can also encode JSON objects back into bytestrings that form the payload
of downlink messages.
Below each message is described and how it is encoded in the bytestring. The Decoder / Encoder is available on
the product support page.
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 6 of 28
5 MESSAGE HEADER
5 Message Header
The header is at the head of all messages. It indicates the protocol version and message type.
"header": {
"message_type": <json string>,
"protocol_version": <json number>
}
Listing 1: JSON Header Structure
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 7 of 28
6 UPLINK MESSAGES
6 Uplink Messages
6.1 Boot
The boot message is sent when the device is used for the first time or when a reboot occurs. Reboots might occur
intended in case of activating a newly received configuration. Or the device might reboot due to a system error as
a matter to recovery (e.g. continues communication failures, unforeseen situations etc). The boot message contains
information why it has (re)booted. Typically this information can be ignored and is only used for solving problems in the
field. During normal operation and with sufficient network quality reboots seldomly occur, other than activating a newly
received configuration.
{
"header": {
"message_type": "boot",
"protocol_version": 2
},
"boot": {
"device_type": <json string>,
"version_hash": <json string>,
"device_config_crc": <json string>,
"application_config_crc": <json string>,
"reset_flags": <json number>,
"reboot_counter": <json number>,
"reboot_info": <json string>,
"last_device_state": <json number>,
"bist": <json number>
}
}
Listing 2: Boot JSON Structure
• "tt" (4)
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 8 of 28
6 UPLINK MESSAGES
reboot_counter uint8 11
Counter of the number of reboots. Each time a reboot
occurs the counter is increased. The counter is 8bit
and will wrap after 255 to 0. This can be used for
detecting abnormal rebooting behavior.
Range:
0 .. 255
reboot_info uint8[9] 12..20
Informational string with: information on the reboot.
Example values: byte[0] reboot type
byte[1..8] specific payload
• "swdog (ABCD)"
• "assert (test:1234)"
• "application (0xaabbccdd)"
• "system (0xaabbccdd)"
last_device_state uint8 21
Last state the device was in before reboot. This can
be used for analysis when a device is not working
properly.
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 9 of 28
6 UPLINK MESSAGES
0: Test Failed
1: Test Succeeded
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 10 of 28
6 UPLINK MESSAGES
6.2 Activated
On activation an activated message is sent. It is an indication that the device is operational.
{
"header": {
"message_type": "activation",
"protocol_version": 2
}
}
Listing 3: Activation JSON Structure
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 11 of 28
6 UPLINK MESSAGES
6.3 Deactivated
When the device is deactivated by a long press a deactivation message is sent. It is an indication that the device is not
operational.
{
"header": {
"message_type": "deactivation",
"protocol_version": 2
}
}
Listing 4: Deactivation JSON Structure
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 12 of 28
6 UPLINK MESSAGES
{
"header": {
"message_type": "application_event",
"protocol_version": 2
},
"application_event": {
"trigger": <json string>,
"temperature": {
"min": <json number>,
"max": <json number>,
"avg": <json number>
},
"condition_0": <json number>,
"condition_1": <json number>,
"condition_2": <json number>,
"condition_3": <json number>
}
}
Listing 5: Application JSON Structure
"timer" (0)
- "On the periodic timer"
"condition_0" (1)
"condition_1" (2)
"condition_2" (3)
"condition_3" (4)
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 13 of 28
6 UPLINK MESSAGES
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 14 of 28
6 UPLINK MESSAGES
{
"header": {
"message_type": "device_status",
"protocol_version": 2
},
"device_status": {
"device_config_crc": <json string>,
"application_config_crc": <json string>,
"event_counter": <json number>,
"battery_voltage": {
"low": <json number>,
"high": <json number>,
"settle": <json number>
},
"temperature": {
"min": <json number>,
"max": <json number>,
"avg": <json number>
},
"tx_counter": <json number>,
"avg_rssi": <json number>,
"avg_snr": <json number>
}
}
Listing 6: Device Status JSON Structure
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 15 of 28
6 UPLINK MESSAGES
Range: 0 .. 255
battery_voltage uint16[3] 6..11
Voltage measurement in Volt, meant as input for 0.001V per LSB
battery charge estimation in the backend.
Range: 0 dB .. 255 dB
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 16 of 28
7 DOWNLINK MESSAGES
7 Downlink Messages
7.1 Device Configuration
In the device configuration the non application related behavior can be configured. Changing these parameters will have
an effect on battery life and quality of service.
{
"switch_mask": {
"enable_confirmed_event_message": <json bool>
},
"communication_max_retries": <json number>,
"unconfirmed_repeat": <json number>,
"periodic_message_random_delay_seconds": <json number>,
"status_message_interval_seconds": <json number>,
"status_message_confirmed_interval": <json number>,
"lora_failure_holdoff_count": <json number>,
"lora_system_recover_count": <json number>,
"lorawan_fsb_mask": [
<json string>,
<json string>,
<json string>,
<json string>,
<json string>
],
"header": {
"message_type": <json string>,
"protocol_version": <json number>
}
}
Listing 7: Device Config JSON Structure
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 17 of 28
7 DOWNLINK MESSAGES
periodic_message_random_delay_seconds 60 uint8 4
To avoid clustering and collisions of uplink
transmissions of multiple devices a random delay is Binary (hex):
added to periodic messages (device status message 0x3C
and timer triggered event message).
Range: 0 .. 255
Range: 0 .. 255
lora_system_recover_count 1 uint8 9
The number of attempts the LoRa handler is trying to
recover from a system failure (not responsive radio). Binary (hex):
0x01
Range: 0 .. 255
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 18 of 28
7 DOWNLINK MESSAGES
Binary (hex):
0xFF
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
EU868:
{“0x0000”,
“0x0000”,
“0x0000”,
“0x0000”,
“0x0000”}
Binary (hex):
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
7.1.3 Example
The device configuration message is constructed of the 1 byte header, the configuration payload and the 2 byte CRC.
The default configuration is obtained by concatenating the header (0x25) with the default values of config payload and
the calculated CRC.
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 19 of 28
7 DOWNLINK MESSAGES
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 20 of 28
7 DOWNLINK MESSAGES
{
"device_type": <json string>,
"temperature_measurement_interval_seconds": <json number>,
"periodic_event_message_interval": <json number>,
"events": [
{
"mode": <json string>,
"threshold_temperature": <json number>,
"measurement_window": <json number>
},
{
"mode": <json string>,
"threshold_temperature": <json number>,
"measurement_window": <json number>
},
{
"mode": <json string>,
"threshold_temperature": <json number>,
"measurement_window": <json number>
},
{
"mode": <json string>,
"threshold_temperature": <json number>,
"measurement_window": <json number>
}
],
"header": {
"message_type": <json string>,
"protocol_version": <json number>
}
}
Listing 8: Application Config JSON Structure
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 21 of 28
7 DOWNLINK MESSAGES
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 22 of 28
7 DOWNLINK MESSAGES
Binary (hex):
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 23 of 28
7 DOWNLINK MESSAGES
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 24 of 28
7 DOWNLINK MESSAGES
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 25 of 28
7 DOWNLINK MESSAGES
7.2.4 Example
The application configuration message is constructed of the 1 byte header, the configuration payload and the 2 byte
CRC. The default configuration is obtained by concatenating the header (0x26) with the default values of config payload
and the calculated CRC, which results in the following byte string:
The payload length n is fixed per config type. The CRC is calculated over the config payload only, so without the
message header.
The two CRC bytes are the inverse of the lower two bytes of a CRC32 calculation. For the CRC32 calculation the CRC-
32/ISO-HDLC is used. This is the default in many protocols and the implementation is widely available in many libraries.
The two CRC bytes in the protocol can be extracted as followed (pseudo code):
crc = default_crc32([config_payload])
inverse_crc = crc ^ 0xFFFFFFFF
crc_byte0 = inverse_crc & 0xFF
crc_byte1 = (inverse_crc >> 8) & 0xFF
Listing 9: CRC Function Pseudo
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 26 of 28
7 DOWNLINK MESSAGES
Python
CRC function in Python.
import binascii
def calc_crc(bs):
crc = binascii.crc32(bs)
return (crc & 0xFFFF) ^ 0xFFFF
Listing 10: CRC Function Python
Javascript
CRC function in Javascript.
// calc_crc inspired by https://github.com/SheetJS/js-crc32
function calc_crc(buf) {
function signed_crc_table() {
var c = 0, table = new Array(256);
This results in "Calculated CRC: 0x55d4", which are encoded as the two CRC bytes (hex): d4,55
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 27 of 28
Revision History
6020_P20-002_Communication-Protocol-NEON-Temperature-Transmitter_C 28 of 28