mirror of
https://github.com/esphome/esphome.git
synced 2026-05-23 19:55:33 +08:00
[thermostat] Fix supplemental action never firing via max run time (#16308)
This commit is contained in:
@@ -506,8 +506,10 @@ void ThermostatClimate::switch_to_action_(climate::ClimateAction action, bool pu
|
||||
case climate::CLIMATE_ACTION_IDLE:
|
||||
if (this->idle_action_ready_()) {
|
||||
this->start_timer_(thermostat::THERMOSTAT_TIMER_IDLE_ON);
|
||||
if (this->action == climate::CLIMATE_ACTION_COOLING)
|
||||
if (this->action == climate::CLIMATE_ACTION_COOLING) {
|
||||
this->start_timer_(thermostat::THERMOSTAT_TIMER_COOLING_OFF);
|
||||
this->cancel_timer_(thermostat::THERMOSTAT_TIMER_COOLING_MAX_RUN_TIME);
|
||||
}
|
||||
if (this->action == climate::CLIMATE_ACTION_FAN) {
|
||||
if (this->supports_fan_only_action_uses_fan_mode_timer_) {
|
||||
this->start_timer_(thermostat::THERMOSTAT_TIMER_FAN_MODE);
|
||||
@@ -515,8 +517,10 @@ void ThermostatClimate::switch_to_action_(climate::ClimateAction action, bool pu
|
||||
this->start_timer_(thermostat::THERMOSTAT_TIMER_FANNING_OFF);
|
||||
}
|
||||
}
|
||||
if (this->action == climate::CLIMATE_ACTION_HEATING)
|
||||
if (this->action == climate::CLIMATE_ACTION_HEATING) {
|
||||
this->start_timer_(thermostat::THERMOSTAT_TIMER_HEATING_OFF);
|
||||
this->cancel_timer_(thermostat::THERMOSTAT_TIMER_HEATING_MAX_RUN_TIME);
|
||||
}
|
||||
// trig = this->idle_action_trigger_;
|
||||
ESP_LOGVV(TAG, "Switching to IDLE/OFF action");
|
||||
this->cooling_max_runtime_exceeded_ = false;
|
||||
@@ -599,16 +603,6 @@ void ThermostatClimate::switch_to_action_(climate::ClimateAction action, bool pu
|
||||
}
|
||||
|
||||
void ThermostatClimate::switch_to_supplemental_action_(climate::ClimateAction action) {
|
||||
// Always cancel max-runtime timers and clear exceeded flags when transitioning to idle/off,
|
||||
// even if supplemental_action_ is already idle (early-return path). This prevents a stale
|
||||
// heating_max_runtime_exceeded_ flag from triggering supplemental on the next heating cycle
|
||||
// when HEATING_MAX_RUN_TIME fires while the main action is already IDLE.
|
||||
if (action == climate::CLIMATE_ACTION_OFF || action == climate::CLIMATE_ACTION_IDLE) {
|
||||
this->cancel_timer_(thermostat::THERMOSTAT_TIMER_COOLING_MAX_RUN_TIME);
|
||||
this->cancel_timer_(thermostat::THERMOSTAT_TIMER_HEATING_MAX_RUN_TIME);
|
||||
this->cooling_max_runtime_exceeded_ = false;
|
||||
this->heating_max_runtime_exceeded_ = false;
|
||||
}
|
||||
// setup_complete_ helps us ensure an action is called immediately after boot
|
||||
if ((action == this->supplemental_action_) && this->setup_complete_) {
|
||||
// already in target mode
|
||||
|
||||
Reference in New Issue
Block a user