[Firmware] Adapt Decoder for Climate+Alarm Sensors

This commit is contained in:
seiichiro 2020-06-21 21:35:40 +02:00
parent 4e25baf91e
commit 9a51210f38

View file

@ -37,6 +37,10 @@ function Decoder(bytes, port) {
if (bytes.length >= 9)
decoded.h = ((bytes[5]) | (bytes[6] << 8 ) | (bytes[7] << 16 ) | (bytes[8] << 24)) / 100.0;
// Alarm Triggered (uint8_t)
if (bytes.length == 10)
decoded.a = bytes[9];
// SHT21 + Brightness (int16_t)
if (bytes.length == 11)
decoded.b = ((bytes[9]) | (bytes[10] << 8 ));
@ -45,6 +49,10 @@ function Decoder(bytes, port) {
if (bytes.length >= 13)
decoded.p = ((bytes[9]) | (bytes[10] << 8 ) | (bytes[11] << 16 ) | (bytes[12] << 24)) / 100.0;
// Alarm Triggered (uint8_t)
if (bytes.length == 14)
decoded.a = bytes[13];
// BME280 + Brightness (int16_t)
if (bytes.length == 15)
decoded.b = ((bytes[13]) | (bytes[14] << 8 ));