Payload format for the sensebox

Sorry, that’s quite a huge repository; I’m not going to browse it to see if I happen to find the code you’re using. In fact, I couldn’t quickly find your example code as it’s a fork and GitHub doesn’t support code search in forks. Where did you get that lux % 255 from?

But to be sure: the MSB and LSB that you need to know about (and which I think is LSB; see my previous answer) is that of the addUint16 and addHumidity functions. It won’t be different for each sensor, as in the code you have proper types already, like float, double or uint16_t, which is all handled automatically for you. It’s only when encoding them for the LoRa transmission that you need to know explicitly what bit order is used. (Again: I’m quite sure it’s LSB.)

Above you’re only using 8 of the 16 bits transmitted for each value. So this will only be correct for small values, where the MSB values in byte[13] and in byte[15] happen to be 0x00.

Oh, I just noticed a difference for the types of uv and lux:

So, unsigned 32 bits vs 16 bits. That’s weird, as your encoding handles both as 8 + 16 = 24 bits:

Above, the MSB of the 32 bits lux is ignored (so, hopefully is always 0x00), while for uv the MSB for message.addUint16(uv / 255) will always be 0x00 as uv is only 16 bits to start with…

Maybe you’d better use:

message.addUint16(lux);
message.addUint16(lux >> 16);
...
message.addUint16(uv);

…along with:

// 32 bits unsigned integer, LSB
decoded.lux = uint(bytes.slice(i, i+=4));
// 16 bits unsigned integer, LSB
decoded.uv = uint(bytes.slice(i, i+=2));

Messy!