At the moment I have separate applications set up for each type of sensor. They send different types of payloads depending on the sensor, therefore requiring different payload decoding. Is there a way to choose certain payload decoders for different sensors within the same application? In other words, would I be able to combine my applications into one, and have the decoder determine each sensor before decoding it?
You could use different ports for different payloads to determine which decoder to use.
You could use Cayenne LPP 2.0 protocol.
I have experienced the same situation, when sometimes a device has a different sensor configuration. In the decoder I do some checks based on message length. For example, if message is 9 bytes or longer, we read the GPS coördinates from the first 9 bytes, and if the message length is 40 bytes, I know there is some dB audio info I can read from the last few bytes.
This is what Cayenne LLP protocol is for. Each sensor has a type and a port, and art the other end you can then determine what dat came from what sensor. This means that in one payload you can have multiple sensor data, and even ( for example ) two temperature sensors. There is a data overhead using Cayenne, b ut it has been specifically designed for small payload data transmission.
I would add that I found the CayenneLPP very easy to use.
I built a GPS tracker and decided to add a temperature sensor as device 2, building the code was easy;
loraData = 0x01;
loraData = LPP_GPS;
loraData = lat >> 16;
loraData = lat >> 8;
loraData = lat;
loraData = lon >> 16;
loraData = lon >> 8;
loraData = lon;
loraData = altitudeGPS >> 16;
loraData = altitudeGPS >> 8;
loraData = altitudeGPS;
loraData = 0x02;
loraData = LPP_TEMPERATURE;
loraData = temp >> 8;
loraData = temp;
And using CayenneLPP does avoid the use of voodoo json code in the payload decoder …