lpp-node
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

Cayenne Low Power Payload for Node.js

Unofficial library for dealing with Cayenne LPP in Node.js

Features

  • Decode LPP

API

LPPDecoder

Decoder class with built-in decoders for standard types defined in the Cayenne LPP specification format.

LPPDecoder.decode(data: Buffer): DecoderOutput<unknown>[]

Takes a buffer as an argument and produce an array of DecoderOutput which has the following structure (in case of number as the type of the data):

{
    data: 24.3,
    channel: 1,
    label: "Temperature Sensor",
    type: 103
}

Example:

const { LPPDecoder } = require(`lpp-node`);

const lpp = new LPPDecoder();
const payload = Buffer.from('018806765ff2960a0003e8', 'hex');

const decoded = lpp.decode(payload);

// decoded value:
// [ { data: {
//          latitude: 42.3519,
//          longitude: -87.9094,
//          altitude: 10
//     },
//     channel: 1,
//     label: "GPS",
//     type: 136 } ]

Readme

Keywords

none

Package Sidebar

Install

npm i lpp-node

Weekly Downloads

1

Version

3.0.1

License

MIT

Unpacked Size

32.5 kB

Total Files

59

Last publish

Collaborators

  • alwin_wint3r