Cayenne LPP encoder in Python

TTN version: TTNv3
Last updated: March 31, 2023

The Cayenne Low Power Payload (LPP) provides a convenient and easy way to send data over LPWAN networks such as LoRaWAN. The Cayenne LPP is compliant with the payload size restriction, which can be lowered down to 11 bytes, and allows the device to send multiple sensor data at one time. Cayenne LPP has several specific functions for some types of data, such as humidity, temperature, pressure, GPS and more.

More information can be found in the Cayenne LPP documentation.


Download and example usage
  1. Download as ZIP this CayenneLPP.
  2. There is an in the CayenneLPP folder that you can use.


Example usage in your script
  1. Import downloaded to your script:
    import src.cayenneLPP as cayenneLPP
  2. Create lpp array:
    lpp = []
  3. Append your data to the array (for example add temperature 25.5 °C to channel 1):
    lpp.append([1, "addTemperature", 25.5])
  4. Call the cayenneLPP.encodeCayenneLPP(lpp) function, where lpp is array with your data. The function returns encoded data:
    payload = cayenneLPP.encodeCayenneLPP(lpp)
  5. The whole code will look like this:
    import src.cayenneLPP as cayenneLPP
    lpp = []
    lpp.append([1, "addTemperature", 25.5])
    payload = cayenneLPP.encodeCayenneLPP(lpp)
  6. The printed output (payload) will look like this:


Data types

All data types can be found in this table.