From 6fbc09dd0a3d086772e338b1aaca9c2c7f5bfb43 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Wed, 2 Oct 2024 17:36:21 +0100 Subject: [PATCH] idle also counts as state change --- sensor/src/sensor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sensor/src/sensor.cpp b/sensor/src/sensor.cpp index 2209d9e..1df9b4d 100644 --- a/sensor/src/sensor.cpp +++ b/sensor/src/sensor.cpp @@ -808,12 +808,12 @@ void handleMessage(size_t len, uint8_t buf[]) { String cmd = result.substring(34, 44); if (cmd == "0000000000") { // none - } else if (cmd.substring(0, 4) == "01") { + } else if (cmd.substring(0, 2) == "01") { state = "Temp Up"; - } else if (cmd.substring(0, 4) == "02") { + } else if (cmd.substring(0, 2) == "02") { state = "Temp Down"; } else { - telnetSend("CMD: " + cmd); + telnetSend("Unknown CMD: " + cmd); } if (!lastRaw3.equals(cmd)) { // Controller responded to command @@ -826,9 +826,11 @@ void handleMessage(size_t len, uint8_t buf[]) { } } - if (!lastRaw3.equals(cmd) && cmd != "0000000000") { // ignore idle command + if (!lastRaw3.equals(cmd)) { lastRaw3 = cmd; rawData3.setValue(lastRaw3.c_str()); + // telnetSend("CMD state: " + state); + // telnetSend("CMD: " + cmd); } if (result.substring(10, 12) == "43" || result.substring(10, 12) == "46") { // "C" or "F"