A library for Cayenne LPP

  • Hi all,

    Recently I had to do a few projects using LoPy boards, The Things Network and its Cayenne Integration to quickly build some dashboard.

    In order to use the integration, the packets send by the LoPy should use the in the Low Power Payload format.

    To facilitate that, I made a simple library and thought I would share it with you since it could be useful to someone else. It is available on GitHub.

    The type of sensors compatible with this library are:

    • digital input/output;
    • analog input/output;
    • luminosity (or illuminance) sensor;
    • presence sensor;
    • temperature sensor;
    • humidity sensor;
    • accelerometer;
    • barometer;
    • gyrometer;
    • and gps.

    Here is a small example of how it works, assuming that the network join has already been done:

    import socket
    # 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)
    # 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(False, channel = 112)
    # sending the packet via the socket

    There are some other examples in the GithHub repo.

    Hope it help :)



  • administrators

    @jojo said in A library for Cayenne LPP:



    Thanks for sharing this with the rest of the community, it looks very useful and very well documented!

Log in to reply

Pycom on Twitter

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.