Using CayenneLPP with a sensor that outputs multiple readings

I have a device, that has multiple sensors.
Each sensor outputs multiple readings. (this is the issue) CayenneLPP works great if each of your
devices outputs only 1 reading using the channels, however. I would like to group multiple device readings together so I can more logically identify them in the output data.
An example of this is:

lpp.addLuminosity(1, uv.readVisible());
lpp.addLuminosity(2, uv.readUV());

Where these 2 readings can be sent on channels 1 and 2, however, there is nothing showing they are from the one sensor. What would be great is if I could have a sensor flag such as

lpp.addLuminosity(1, 1, uv.readVisible());
lpp.addLuminosity(1, 2, uv.readUV());

lpp.addLuminosity(2, 1, uv.readVisible());
lpp.addLuminosity(2, 2, uv.readUV());

Has anyone found a way around this limitation with CayenneLPP? Or does anyone know of a good alternative?

I was at first hoping to use CayenneLPP as it seems to have community support, but if this is a limitation that cannot be overcome, I hope to find an efficient alternative. Possibly I may have to modify the Cayenne lib myself… (i hope not)

Thank you very much!

What is the destination for your data? ie, does the end point support CayenneLPP or does it only support CayenneLPP.

Overall, I can see it’s utility as a quick win if the data is being ingested by Cayenne but it does auto-expand your payload and there are approximately one billion missing formats for all sorts of sensors.

The endpoint is a Node.JS endpoint that I wrote, so it can support whatever I want it to.
I should also mention that I have designed my device so I can add/remove sensors on the fly, and that is why I need to have the ability to see what data is coming from what sensor specifically.

The sensors are all ModBus, so I am using the ModBus Address to ID each sensor.

Do you know of any pre-made alternative? If not, I may have to get to work and try to work something out myself. I am just really hoping that this is a wheel that has already been created.

Possible solution:

Use the channel as two nibbles, first nibble is the device (limited to 0-15 so 16 values) and the second nibble as channel within the device (max 15 channels so fails if you have > 15 sensors per device).

1 Like