cayenne.lpp.decode action

cayenne.decode trigger action accepts a binary input and converts it into a cayenne.lpp encoded string. The Cayenne LPP (Low Power Payload) provides a convenient way to send data over LPWAN (Low-power, wide-area networks).  The LPP protocol (https://github.com/myDevicesIoT/cayenne-docs/blob/master/docs/LORA.md) allows for clear compact binary packets to be sent and decoded without deep knowledge about the data structure. 

The Cayenne LPP enables the devices to send different sensor data in different frames. Each sensor data is prefixed with two bytes that contain the Data Channel and Data Type information. The format of the data is as follows:

Data1 Channel Data1 Type Data   Data2 Channel Data2 Type Data ..... 1 Byte 1 Byte N Bytes 1 Byte 1 Byte N Bytes .....
  • Data Channel: Uniquely identifies each sensor in the device across frames. For example, Temperature sensor

  • Data Type: Identifies the data type in the frame. For example, Temperature

Each data type uses one or more bytes to send the data according to the following table:

TypeIPSOLPPHexData SizeData Resolution per bit
Digital Input32000011
Digital Output32011111
Analog Input32022220.01 Signed
Analog Output32033320.01 Signed
Illuminance Sensor33011016521 Lux Unsigned MSB
Presence Sensor33021026611
Temperature Sensor33031036720.1 °C Signed MSB
Humidity Sensor33041046810.5 % Unsigned
Accelerometer33131137160.001 G Signed MSB per axis
Barometer33151157320.1 hPa Unsigned MSB
Gyrometer33341348660.01 °/s Signed MSB per axis
GPS Location3336136889Latitude : 0.0001 ° Signed MSB Longitude : 0.0001 ° Signed MSB Altitude : 0.01 meter Signed MSB

Examples

Device with 2 temperature sensors

Payload (Hex) 03 67 01 10 05 67 00 FF Data ChannelType Value 03 ⇒ 3 67 ⇒ Temperature 0110 = 272 ⇒ 27.2°C 05 ⇒ 5 67 ⇒ Temperature 00FF = 255 ⇒ 25.5°C

Device with temperature and acceleration sensors

Frame N

Payload (Hex) 01 67 FF D7 Data ChannelTypeValue 01 ⇒ 1 67 ⇒ Temperature FFD7 = -41 ⇒ -4.1°C

Frame N+1

Payload (Hex) 06 71 04 D2 FB 2E  00 00Data Channel TypeValue 06 ⇒ 6 71 ⇒ Accelerometer X: 04D2 = +1234 ⇒ +1.234G Y: FB2E = -1234 ⇒ -1.234GZ: 0000 = 0 ⇒ 0G

Device with GPS

Payload (Hex) 01 88 06 76 5f f2 96 0a  00 03 e8Data Channel TypeValue 01 ⇒ 1 88 ⇒ GPS Latitude: 06765f ⇒ 42.3519 Longitude: F2960a ⇒ -87.9094Altitude: 0003E8 ⇒ 10 meters

Action

To access the cayenne.decode trigger action:

  • In the Adding trigger screen, under Binary click and drag the cayenne.decode to the canvas.

Canvas

When dragged onto the canvas, the appearance of the action is a rectangle with two routing points.

The left routing point (red) is the failure route. This route will be taken if there is an error during execution.

The right routing point (green) is the success route. This route will be taken if action executes successfully.

Form

Parameters

NameTypeRequiredDescription
InputStringYesThe cayenne.lpp string to be converted.

Action variable

This action returns multiple values for each channel sent in the packet.  In the examples below, Y is the channel number that is received.

NameTypeDescription
$(action.X.channels.Y.name)String

The name of the sensor type, this will be a human-readable name such as Analog Input or Temperature Sensor.

$(action.X.channels.Y.key)StringThe string key for the sensor type, this will be ideal as a programmatic key such as analogIn or temperature.
$(action.X.channels.Y.value)Varies

For numerical sensor types, this value will be a floating point value.

For accelerometer and gyrometer, the result will be an object with x, y, and z values.

For GPS, the result will be an object with lat, lng, and alt fields.