diff --git a/include/devices.h b/include/devices.h index 966be05..1b32d0a 100644 --- a/include/devices.h +++ b/include/devices.h @@ -51,6 +51,10 @@ namespace Devices { auto value = String{ msg }.toInt(); timer = value; displayTimerMqtt->updateState(value); + if (Display::tTimer.isEnabled()) { + Display::tTimer.cancel(); + Display::tTimer.enable(); + } } }).withMin(0).withMax(90).withStep(5).restoreStateFromCommand().build(); Sensor* timerRemainingMqtt = Builder::instance(new Sensor("Timer remaining", "timer_remaining")) @@ -61,7 +65,7 @@ namespace Devices { Display::tTimer.restart(); timerMqtt->updateState(true); } else { - Display::tTimer.disable(); + Display::tTimer.cancel(); timerMqtt->updateState(false); } }