allow changing timer while it is on

This commit is contained in:
Nicu Hodos 2025-02-28 14:11:22 +01:00
parent 0882cb0a19
commit 16befa50e5

View File

@ -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<Sensor>::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);
}
}