Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

A Python module for the Cayenne Low Power Packet format

It aims to facilate the conversion of values typically read from sensors to a sequence of bits (the payload) that can be send over a network using the Cayenne Low Power Packet format. This format is particularly suited for LPWAN networks such as LoRaWAN.

The payload can then be send for instance to an application of The Things Network, a LoRaWAN-based community network, which will then forward the data to a Cayenne application thanks to its Cayenne integration.

The module consists of constants defining the different sensors and their size and one class CayenneLPP containing the methods to build a payload.

The constants have the format NAME_SENSOR = (LPP id, Data size) where LPP id is the IPSO id - 3200 and Data size is the number of bytes that must be used to encode the reading from the sensor.

More info here: https://mydevices.com/cayenne/docs/lora/#lora-cayenne-low-power-payload-overview

CayenneLPP class

The class contains the methods to pack data from sensors in a Cayenne LPP format. The payload structure for the Cayenne LPP format is data frame of the form: [SENSOR_1, SENSOR_2, … SENSOR_N], where the format for one sensor is defined by: [CHANNEL, SENSOR TYPE, DATA].

The channel is an unique identifier for each sensor in the data frame.

The type of sensors compatible with this class are: - digital input/output; - analog input/output; - luminosity (or illuminance) sensor; - presence sensor; - temperature sensor; - humidity sensor; - accelerometer; - barometer; - gyrometer; - gps.

An object of this class has 3 attributes: - payload: the data from one or more senors formatted with the Cayenne LPP format; - size: the maximum size of the payload (depends on the network on which the data will be send to); - socket: a socket via which we can send the payload.

The constructor will generate an object with an empty payload and with a maximum size.

It is possible to reset the payload with the ‘reset’ method and change the maximum size with the ‘change_size’ method.

The current payload and maximum size can be obtained with the methods ‘get_payload’ and ‘get_size’ methods.

You can send the payload via the socket using the ‘send’ method. The socket can be set using the ‘set_socket’ method.

To add the data from a sensor, the methods ‘add_sensor_name’ are provided.

The documentation is provided in the directory doc of the GitHub repository.

Example

# importing the module
import cayenneLPP

# create a LoRa socket
s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
s.setsockopt(socket.SOL_LORA, socket.SO_DR, 0)
s.setblocking(True)

# creating Cayenne LPP packet
lpp = cayenneLPP.CayenneLPP(size = 100, sock = s)

# adding 2 digital outputs, the first one uses the default channel
lpp.add_digital_input(True)
lpp.add_digital_input(False, channel = 112)

# sending the packet via the socket
lpp.send()

Scripts to test the module with a LoPy (https://www.pycom.io/) and The Things Network is provided in the test_lopy directory. Note that you need to update the values of app_eui and app_key with the correct credentials.

Metadata

Release files for cayenneLPP 0.5b3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cayenneLPP 0.5b3
File Size Uploaded
cayenneLPP-0.5b3.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cayenneLPP 0.5b3
File Interpreter ABI Platform
cayenneLPP-0.5b3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 14.9 kB

Release files / cayenneLPP-0.5b3.tar.gz

Download URL cayenneLPP-0.5b3.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b1e58694b38d94fdc969ce764e391704907b92fbd2143ac579d882ec5c390202
BLAKE2b-256 checksum
How to use checksums
4da74f00b1a8e1f11de8125950a8c3762469dbc589517dc4ecd94f05ac8c490f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cayenneLPP-0.5b3-py2.py3-none-any.whl

Download URL cayenneLPP-0.5b3-py2.py3-none-any.whl
Size 9.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2df71d93bc1bc79797357b5483565dcf0a6a1d32ced849346f4a756f6c77a950
BLAKE2b-256 checksum
How to use checksums
17311cfed93fe2d6c779bca4c81bf497ce6dbd0a9ff4f1cadb8e7aa8cdf6164d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.5b3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page