MQPS and Other Data Reporting
The device uses the MachineQ Payload Standard (MQPS) to encode sensor readings and configuration messages. MQPS is a very efficient packet format. This page gives the MQPS specification. The device also supports other commands, for example the last reset reason and the version request.
Packet Overview
MQPS is specific to LoRaWAN. MQPS uses the LoRaWAN packet FPort and the packet direction to encode more data.
- FPorts 1 through 223 encode the contents and the format of the payload (data section) of each packet.
- The direction (uplink or downlink) encodes more data.
The flow chart that follows shows how the FPort and the direction identify the packet types on this page.
Sensor Reading
FPorts 1 through 63 encode sensor readings. The device uses the FPort number as a bit mask. Each bit identifies one sensor. The decoder uses the bit mask to find the reading type and to parse the payload. The payload has no other format data or size data.
FPort Format
RFU means reserved for future use.
| Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Sensor | 0 | 0 | RFU | External Sensor | Pressure | Binary data | Humidity | Temperature |
| Data Size | - | - | - | Sensor dependent | 2 | 1 | 1 | 2 |
Sensor Data Types
| Sensor | Data Type | Measurement Unit | Error Code / Values |
|---|---|---|---|
| Temperature | int16 | 0.1 C | 0x8000 |
| Humidity | uint8 | 0.5% | 0xFF |
| Pressure | uint16 | 0.1 hPa | Less than 300 hPa or more than 1250 hPa |
| External Sensor ID | uint8 | NA | NA |
| External Sensor Temperature (ID 0x01) | int16 | 0.1 C | 0x8000 |
External Sensor Data
| Byte | 0 | 1 | 2 |
|---|---|---|---|
| Value | ID | Value High Byte | Value Low Byte |
Binary Sensor Data
| Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Sensor | Motion Enabled | Motion State | Button Enabled | Button State | Water Leak Enabled | Water Leak State | Door/Window Open/Close Enabled | Door/Window State |
Payload Order
The payload contains the readings for all sensors that have a bit set to 1 in the FPort bit mask. The readings are in bit order, from the least significant bit.
Sensor Errors
Note: If the device cannot read a sensor, the device reports an error. The device uses a special value or a value that is out of the normal range. When an error occurs, the
decoded_payloaddoes not contain the field for that sensor. The decoder adds anerrorfield. The decoder decodes all valid values in the same payload correctly.
The possible error messages are:
temperature readinghumidity readingpressure reading
This example shows a decoded payload with valid humidity data and a temperature error:
"decoded_payload": {
"humidity": "55.0",
"error": ["temperature reading"]
}
Example 1: Temperature and Binary Data
FPort: 0x05 (0000 0101)
- Bit 0: Temperature reading.
- Bit 2: Binary data is in the payload.
Data: 0x00E683
- The first 2 bytes are the temperature:
0x00E6= 230 → 230 × 0.1 C = 23.0 C.
- The next byte is the binary data structure:
0x83(1000 0011).- Bit 7: Motion data is present.
- Bit 6: The device does not detect motion. A 1 in this position shows motion.
- Bit 1: Door open/close sensor data is present.
- Bit 0: A 1 in this position shows that the door or window is open.
Example 2: Temperature and Humidity
FPort: 0x03 (0000 0011)
- Bit 0: Temperature reading.
- Bit 1: Humidity reading.
Data: 0x00E611
- The first 2 bytes are the temperature:
0x00E6= 230 → 230 × 0.1 C = 23.0 C.
- The next byte is the humidity:
0x11= 17 → 17 × 0.5% RH = 8.5% RH.
Example 3: Temperature and Humidity Errors
FPort: 0x03 (0000 0011)
- Bit 0: Temperature reading.
- Bit 1: Humidity reading.
Data: 0x8000FF
- The first 2 bytes are the temperature:
0x8000→ Temperature error.
- The next byte is the humidity:
0xFF→ Humidity error.
Configuration
Configuration packets control the operation of the device. Use a LoRaWAN downlink to set the configuration or to get the configuration from the device.
| Packet Type | FPort | Direction | Function |
|---|---|---|---|
| Set | 221 | Downlink | Set the device configuration |
| Get | 222 | Downlink | Request the device configuration |
| Report | 221 | Uplink | Send the requested configuration settings |
Configuration Message Format (Set and Report)
| Configuration Parameter (1) | Parameter Value (1) | Configuration Parameter (2) | Parameter Value (2) | … | Configuration Parameter (N) | Parameter Value (N) |
|---|---|---|---|---|---|---|
| 1 byte | 1-X bytes | 1 byte | 1-X bytes | … | 1 byte | 1-X bytes |
Configuration Message Format (Get)
| Configuration Parameter (1) | Configuration Parameter (2) | … | Configuration Parameter (N) |
|---|---|---|---|
| 1 byte | 1 byte | … | 1 byte |
Configuration Parameters
| Parameter | Name | Size | Units | Range | Default (before v0.26.1) | Default (v0.26.1 and later) |
|---|---|---|---|---|---|---|
| 0x01 | Reporting Period | 2 bytes | Seconds, 2 second increments | 30-65535 (before v0.60.0: 3-65535) | 0x2A30 (6 hours) | 0x0384 (30 minutes). Before v0.60.0: 0x01C2 (15 minutes) |
| 0x02 | Sensor Sample Period | 2 bytes | Seconds, 2 second increments | 1-65535 | 0x003C (2 minutes) | 0x00E1 (7.5 minutes) |
| 0x03 | Temperature Report Delta | 1 byte | 0.1 Celsius | 0-255 | 0x0A (1 Celsius) | 0x64 (10 Celsius) |
| 0x04 | Humidity Report Delta | 1 byte | 0.5% Relative Humidity | 0-200 | 0x0A (5% Relative Humidity) | 0x0A (5% Relative Humidity) |
| 0x05 | Enable/Disable Sensor | 2 bytes | Bit mask and binary sensor structure (see Sensor Reading) | 0-127 for the bit mask. 0-255 for the binary structure | 0x0720 (Activates Temperature, Humidity, and Button) | 0x0100 (Activates Temperature only) |
| 0x06 (v0.26.0) | Sampling Configuration | 1 byte | Bits 0-3: Sample Window + 1. Bits 4-7: Average Window + 1 | 0-15 for the Sample Window. 0-15 for the Average Window | 0x00 (Sample Window and Average Window) | 0x00 (Sample Window and Average Window) |
| 0x07 | Movement Threshold | 2 bytes | mg, 1 mg increments | 8-16000 | 0x0060 (96 mg) | 0x0060 (96 mg) |
| 0x08 | Water Leak Monitoring Config | 1 byte | Bits 0-5: State change period (10 second increments). Bits 6-7: Sensitivity level (3 levels) | 0-64 for the state change period. 0-2 for the sensitivity level (0 is the least sensitive) | 0x43 (State change period is 30 seconds. Sensitivity level is 1 [medium sensitivity]) | 0x43 (State change period is 30 seconds. Sensitivity level is 1 [medium sensitivity]) |
| 0x09 | Pressure Report Delta | 1 byte | 1 hPa | 0-255 | 0x0A (10 hPa) | 0x0A (10 hPa) |
| 0x0A (v0.26.0) | Confirmed Message | 1 byte | Bit mask, sensor structure (see Sensor Reading). Bit 2 (Binary) only affects motion | 0-16 in total (0-1 for each bit). Before v0.60.0: 0-15 in total (0-1 for each bit) | 0x00 (Unconfirmed message for all sensors) | 0x00 (Unconfirmed message for all sensors) |
| 0x0B (v0.57.0) | Advertising Interval | 2 bytes | 625 microseconds | 0: not active. Minimum: 32. Maximum: 16384 | N/A | 0x0000 (Not active) |
| 0x0C (v0.57.0) | External Sensor | 1 byte | External Sensor ID | 0-1 (see External Sensor IDs) | N/A | 0x00 (None) |
| 0x0D (v0.60.0) | Data Caching | 1 byte | Bit mask | 0-1 | N/A | 0x00 |
| 0x0E (v0.65.0) | RTD Delta | 1 byte | 0.1 Celsius | 0-255 | N/A | 0x0A (1 Celsius) |
Note: Integers are unsigned. If a parameter has a different data type, the table gives the data type.
Note: Some SKUs do not have all sensors. You cannot activate a sensor that the SKU does not have. If a Set request sets the enable bit for that sensor, the Report response does not fail. The device sets the enable bit to 0.
External Sensor IDs
| ID | External Sensor |
|---|---|
| 0x00 | None |
| 0x01 | RTD Temperature Probe |
Note: You must install the external sensor before you can activate it. The external sensor works with all MQflex FV3 SKUs that have firmware v0.57.0 or later. You cannot activate Water Leak detection and the External Sensor at the same time.
Data Caching Bit Map
1 = Active. 0 = Not active.
| Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Function | RFU | RFU | RFU | RFU | RFU | RFU | RFU | MQPS Sensor Reading Uplinks |
Set and Report
Set packets and Report packets use the same format and the same FPort number. The packet format is a list of parameter and value pairs. When the device receives a valid Set request, the device sends a Report packet. The Report packet is an exact copy of the Set request. If a parameter or a value is not valid, the device sends 0xFF.
Example 1: Reporting Period and Sample Period
Packet: 01070802003c
Parameter and value pair 0: 010708
- Parameter:
0x01= 1 → Reporting Period. - Value:
0x0708= 1800 → 1800 × 2 sec = 3600 sec = 1 hour.
Parameter and value pair 1: 02003c
- Parameter:
0x02= 2 → Sensor Sample Period. - Value:
0x003c= 60 → 60 × 2 sec = 120 sec = 2 minutes.
Example 2: Configure the Temperature and Humidity Sensors
Packet: 030a0402050300
Parameter and value pair 0: 030a
- Parameter:
0x03= 3 → Temperature Report Delta. - Value:
0x0a= 10 → 10 × 0.1 C = 1 C delta.
Parameter and value pair 1: 0402
- Parameter:
0x04= 4 → Humidity Report Delta. - Value:
0x02= 2 → 2 × 0.5% RH = 1% RH delta.
Parameter and value pair 2: 050300
- Parameter:
0x05→ Enable/Disable Sensor. - Value:
0x0300→ Bit mask → Activate the Temperature sensor and the Humidity sensor.
Example 3: Activate the Door/Window Sensor
Packet: 050402
Parameter and value pair 0: 050402
- Parameter:
0x05→ Enable/Disable Sensor. - Value:
0x0402→ Bit mask → Activate the Door/Window sensor.
Get
Use FPort 222 to send a Get configuration downlink to the device. The packet format is a list of parameters. The device sends the requested configuration values on FPort 221.
Example: Get the Reporting Period and the Sensor Sample Period
Get request downlink on FPort 222: 0102
- Parameter:
0x01= 1 → Reporting Period. - Parameter:
0x02= 2 → Sensor Sample Period.
Response uplink on FPort 221: 01070802003c
Parameter and value pair 0: 010708
- Parameter:
0x01= 1 → Reporting Period. - Value:
0x0708= 1800 → 1800 × 2 sec = 3600 sec = 1 hour.
Parameter and value pair 1: 02003c
- Parameter:
0x02= 2 → Sensor Sample Period. - Value:
0x003c= 60 → 60 × 2 sec = 120 sec = 2 minutes.
Common Configurations
The tables that follow give the recommended configuration settings for common use cases of the device. The first table shows the related parameters. The values in bold are the parameters that change most often for different customer needs.
| Parameter ID | Name | Periodic Temperature (Hex) | Periodic Temperature (Value) | Delta Temperature (Hex) | Delta Temperature (Value) | Water Leak Only (Hex) | Water Leak Only (Value) |
|---|---|---|---|---|---|---|---|
| 0x01 | Reporting Period | 0101C2 | 15 min | 010E10 | 2 hr | 012A30 | 6 hrs |
| 0x02 | Sensor Sample Period | 0200E1 | 7.5 min | 02003C | 2 min | - | NA |
| 0x03 | Temperature Report Delta | 03C8 | 20 deg C | 0314 | 2 deg C | - | NA |
| 0x04 | Humidity Report Delta | - | NA | - | NA | - | NA |
| 0x05 | Enable/Disable Sensor | 050100 | Temp Only | 050100 | Temp Only | 050408 | Water Leak Only |
| 0x06 | Sampling Configuration | - | Default | 0604 | Sample Window: 5. Average Window: 1 | - | NA |
| 0x07 | Movement Threshold | - | NA | - | NA | - | NA |
| 0x08 | Water Leak Monitoring Config | - | NA | - | NA | 0843 | State Change: 30 sec. Sensitivity: 1 (medium) |
| 0x09 | Pressure Report Delta | - | NA | - | NA | - | NA |
| 0x0A | Confirmed Message | - | Unconfirmed | 0A01 | Confirmed | - | NA |
| 0x0B | Advertising Interval | - | NA | - | NA | - | NA |
| 0x0C | External Sensor | - | NA | - | NA | 00 | Not present |
| 0x0D | Data Caching | - | NA | - | NA | - | NA |
| 0x0E | RTD Delta | - | NA | - | NA | - | NA |
The table that follows gives the full configuration downlink for each common use case.
| Description | Configuration Downlink |
|---|---|
| Temperature periodic report | 0101C20200E103C8050100 |
| Temperature delta report with confirmed uplinks | 010E1002003C031405010006040A01 |
| Water leak reporting only | 012A300504080843 |
Reset Reason
At startup, the device sends the last reset reason on FPort 220. The device uses this format:
| Hardware Reset Reason | Software Reset Reason |
|---|---|
| 1 byte | 1 byte |
Hardware Reset Reason
Each bit in the Hardware Reset Reason byte identifies one cause of the last reset. If a bit is set to 1, the related cause started the last reset.
| Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Description | NFC field detected | Entered into debug interface | ANADETECT signal trigger (LPCOMP) | DETECT signal trigger (GPIO) | CPU Lock-up | Soft Reset | Watchdog Reset | Pin |
Software Reset Reason
The Software Reset Reason codes have these meanings:
| Software Reset Reason Code | Description |
|---|---|
| 0 | Unknown (not a Soft Reset, or an unknown source started the reset) |
| 1 | Stack Overflow |
| 2 | Radio Busy |
| 3 | Hard Fault |
| 4 | Assert Error |
| 5 | CLI Command |
| 6 | Factory Reset |
| 7 | Downlink Command |
| 8 | Reserved |
| 9 | App Error |
| 10 (0x0A) | LoRa IRQ |
| 11 (0x0B) | FUOTA (the device received all of the FUOTA packets and restarted to apply the update) |
| 12 (0x0C) | Uplink Timeout. The device did not send an uplink for more than 2 × Reporting Period. |
| 13 (0x0D) | Downlink Timeout. The device did not receive a downlink for more than 24 hours. |
| 14 (0x0E) | FDS Write Failure |
| 15 (0x0F) | Brown Out Mode |
| 16 (0x10) | De-Passivation |
| 17 (0x11) | Confirmed Retransmission Error (the device is in the retransmission state, but did not send a retransmission in the expected window) |
Note: The device sends this uplink as a confirmed uplink.
Join Reason
After each successful join request and join response procedure, the device sends the reason for the join and related data. For the first join procedure after a power cycle, the device sends only the Reset Reason uplink.
The device sends the last join reason on FPort 217. The device uses this format:
| RFU | Join Count | Other Info | Join Reason |
|---|---|---|---|
| 1 byte | 1 byte | 1 byte | 1 byte |
Join Count
The Join Count field gives the number of Join Requests that the device sent before it received the Join Accept message. If the device sent more than 255 Join Requests, the Join Count is 255.
Other Info
The Other Info field gives more data about the join request.
| Bit | 7-2 | 1 | 0 |
|---|---|---|---|
| Description | RFU | The button started the Join Request | A Join Error occurred |
Join Reason Codes
The Join Reason codes have these meanings:
| Join Reason | Description |
|---|---|
| 0 | Initial boot join |
| 1 | The device stopped the join procedure unexpectedly and started the join procedure again. |
| 2 | Rejoin because Confirmed ADR Adaptation failed |
| 3 | Rejoin because Unconfirmed ADR Adaptation failed |
| 4 | The device did not send a join request in the last 6 hours and started the join procedure again. |
Note: The device sends this uplink as a confirmed uplink.
What's Next?
- Sensor Operation - Supported sensors, sensor reporting, sensor operation, data caching, probe calibration, and battery depassivation.
- LoRaWAN Commands and Responses - Device status and device version requests and responses.
- DFU Instructions - Update the device firmware with nRF Connect for Mobile.