From 8fcfb3d8f7a7534b95d0d7cf02475193d1493890 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Sat, 18 Nov 2023 13:55:28 +0100 Subject: [PATCH] fix crash on wrong thermostat mode command (if not using HA) --- src/devices/thermostat.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 93a141fa0..2bbdeee1e 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -2455,8 +2455,9 @@ bool Thermostat::set_mode(const char * value, const int8_t id) { // check for the mode being a full string name or single digit if (!Helpers::value2enum(value, enum_index, mode_list)) { mode_list = FL_(enum_mode_ha); - if (Mqtt::ha_enabled() && !Helpers::value2enum(value, enum_index, mode_list)) { - LOG_WARNING("wrong mode: %s", value); + if (!Mqtt::ha_enabled() || !Helpers::value2enum(value, enum_index, mode_list)) { + // We have logging on fail in command.cpp + // LOG_WARNING("wrong mode: %s", value); return false; // not found } }