Extending Cayenne data types

Currently the Cayenne LPP supports a number of data types show in https://mydevices.com/cayenne/docs/lora/#lora-cayenne-low-power-payload-examples-downlink-message

I have a Cayenne capable device that occasionally sends its battery level using a non-standard data type as shown below:
Screenshot%20from%202018-12-03%2017-15-09

Is there an easy way to add this data type to the cayenne decoder?

If not, is there a custom javascript implementation for the cayenne decoding I could extend to fit any extra data types?

Thank you!

This is (currently) not possible. When devices are not following the defined LPP implementation (https://mydevices.com/cayenne/docs/lora/#lora-cayenne-low-power-payload), then you either have to modify the LoRa App Server source to implement this yourself, or define your own JS custom decoder to handle these cases.

That’s what I figured.

I don’t know how hard it would be to implement within the custom JS but it would be cool to basically have a try catch wrapping the Cayenne decoder so I could say, in case cayenne fails -> try the custom code.

In case anyone has the same issue, I found a JS implementation of Cayenne lpp decoding and adapted it to match the default cayenne decoder output: I didn’t write the Encode portion but I don’t know how necessary it is…

I ended up extending via the go code since I didn’t want to have to deal with the encoding portion via js:

I ended up having to copy a lot of code because of how go type inheritance works (or at least my limited go experience). It probably is possible to make the encode/decode code portions more object oriented so the CayennLPP is easier to extend.

Hi @Safrone. Were you able to extend datatype during encoding also?

I copied the encoding/decoding format for the cayenne payloads so both should work like the standard cayenne codec