mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 21:44:55 +01:00
[Sprinkler] Resume fixes (#5100)
This commit is contained in:
parent
3ac0165f00
commit
508392db6e
1 changed files with 11 additions and 3 deletions
|
@ -954,10 +954,18 @@ void Sprinkler::pause() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sprinkler::resume() {
|
void Sprinkler::resume() {
|
||||||
|
if (this->standby()) {
|
||||||
|
ESP_LOGD(TAG, "resume called but standby is enabled; no action taken");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this->paused_valve_.has_value() && (this->resume_duration_.has_value())) {
|
if (this->paused_valve_.has_value() && (this->resume_duration_.has_value())) {
|
||||||
|
// Resume only if valve has not been completed yet
|
||||||
|
if (!this->valve_cycle_complete_(this->paused_valve_.value())) {
|
||||||
ESP_LOGD(TAG, "Resuming valve %u with %u seconds remaining", this->paused_valve_.value_or(0),
|
ESP_LOGD(TAG, "Resuming valve %u with %u seconds remaining", this->paused_valve_.value_or(0),
|
||||||
this->resume_duration_.value_or(0));
|
this->resume_duration_.value_or(0));
|
||||||
this->fsm_request_(this->paused_valve_.value(), this->resume_duration_.value());
|
this->fsm_request_(this->paused_valve_.value(), this->resume_duration_.value());
|
||||||
|
}
|
||||||
this->reset_resume();
|
this->reset_resume();
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGD(TAG, "No valve to resume!");
|
ESP_LOGD(TAG, "No valve to resume!");
|
||||||
|
|
Loading…
Reference in a new issue