allow changing timer while it is on
This commit is contained in:
parent
0882cb0a19
commit
16befa50e5
@ -51,6 +51,10 @@ namespace Devices {
|
|||||||
auto value = String{ msg }.toInt();
|
auto value = String{ msg }.toInt();
|
||||||
timer = value;
|
timer = value;
|
||||||
displayTimerMqtt->updateState(value);
|
displayTimerMqtt->updateState(value);
|
||||||
|
if (Display::tTimer.isEnabled()) {
|
||||||
|
Display::tTimer.cancel();
|
||||||
|
Display::tTimer.enable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).withMin(0).withMax(90).withStep(5).restoreStateFromCommand().build();
|
}).withMin(0).withMax(90).withStep(5).restoreStateFromCommand().build();
|
||||||
Sensor* timerRemainingMqtt = Builder<Sensor>::instance(new Sensor("Timer remaining", "timer_remaining"))
|
Sensor* timerRemainingMqtt = Builder<Sensor>::instance(new Sensor("Timer remaining", "timer_remaining"))
|
||||||
@ -61,7 +65,7 @@ namespace Devices {
|
|||||||
Display::tTimer.restart();
|
Display::tTimer.restart();
|
||||||
timerMqtt->updateState(true);
|
timerMqtt->updateState(true);
|
||||||
} else {
|
} else {
|
||||||
Display::tTimer.disable();
|
Display::tTimer.cancel();
|
||||||
timerMqtt->updateState(false);
|
timerMqtt->updateState(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user