Using a jeelabs HAT on a Raspberry Pi to receive RF data from remote sensors, which can then be picked up by a 'serial in node' from /dev/ttyAMA0
.
The payload received by the serial node takes the following format;
OK 10 22 1 0 0 0 0 237 94 188 4 (-61)
where OK
is the acknowledgement, 10
is the respective device node, and (-61)
is the RSSI of the device.
The remaining 10 bytes are data pairs, which then need decoding into 5 device sensor readings as follows;
x= ([1st byte] + ([2nd byte] * 2^8));
if (x > 2^15) {
x = (x - (2^16));
}
return x
Each device follows the same format but may have a different number of byte pairs, for example a temperature node may have 3 byte pairs - temperature, humidity & battery.
The goal would be to get the data into a usable format, something like??
I've looked through existing nodes in the library, and can't see anything specifically for jeelib, but there a node-red-contrib-binary
although it doesn't seem to handle this format.
I really don't know where to start with this, so any help would be appreciated.