mirror of
https://github.com/esphome/esphome.git
synced 2025-09-15 17:52:19 +01:00
[thermostat] Rename timer enums to mitigate naming conflict (#10666)
This commit is contained in:
committed by
Jesse Hills
parent
2401f81be3
commit
56e85b3ef9
@@ -11,11 +11,11 @@ static const char *const TAG = "thermostat.climate";
|
|||||||
void ThermostatClimate::setup() {
|
void ThermostatClimate::setup() {
|
||||||
if (this->use_startup_delay_) {
|
if (this->use_startup_delay_) {
|
||||||
// start timers so that no actions are called for a moment
|
// start timers so that no actions are called for a moment
|
||||||
this->start_timer_(thermostat::TIMER_COOLING_OFF);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_COOLING_OFF);
|
||||||
this->start_timer_(thermostat::TIMER_FANNING_OFF);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_FANNING_OFF);
|
||||||
this->start_timer_(thermostat::TIMER_HEATING_OFF);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_HEATING_OFF);
|
||||||
if (this->supports_fan_only_action_uses_fan_mode_timer_)
|
if (this->supports_fan_only_action_uses_fan_mode_timer_)
|
||||||
this->start_timer_(thermostat::TIMER_FAN_MODE);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_FAN_MODE);
|
||||||
}
|
}
|
||||||
// add a callback so that whenever the sensor state changes we can take action
|
// add a callback so that whenever the sensor state changes we can take action
|
||||||
this->sensor_->add_on_state_callback([this](float state) {
|
this->sensor_->add_on_state_callback([this](float state) {
|
||||||
@@ -307,9 +307,10 @@ climate::ClimateAction ThermostatClimate::compute_action_(const bool ignore_time
|
|||||||
return climate::CLIMATE_ACTION_OFF;
|
return climate::CLIMATE_ACTION_OFF;
|
||||||
}
|
}
|
||||||
// do not change the action if an "ON" timer is running
|
// do not change the action if an "ON" timer is running
|
||||||
if ((!ignore_timers) &&
|
if ((!ignore_timers) && (this->timer_active_(thermostat::THERMOSTAT_TIMER_IDLE_ON) ||
|
||||||
(this->timer_active_(thermostat::TIMER_IDLE_ON) || this->timer_active_(thermostat::TIMER_COOLING_ON) ||
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_COOLING_ON) ||
|
||||||
this->timer_active_(thermostat::TIMER_FANNING_ON) || this->timer_active_(thermostat::TIMER_HEATING_ON))) {
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_FANNING_ON) ||
|
||||||
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_HEATING_ON))) {
|
||||||
return this->action;
|
return this->action;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,18 +445,18 @@ void ThermostatClimate::switch_to_action_(climate::ClimateAction action, bool pu
|
|||||||
case climate::CLIMATE_ACTION_OFF:
|
case climate::CLIMATE_ACTION_OFF:
|
||||||
case climate::CLIMATE_ACTION_IDLE:
|
case climate::CLIMATE_ACTION_IDLE:
|
||||||
if (this->idle_action_ready_()) {
|
if (this->idle_action_ready_()) {
|
||||||
this->start_timer_(thermostat::TIMER_IDLE_ON);
|
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::TIMER_COOLING_OFF);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_COOLING_OFF);
|
||||||
if (this->action == climate::CLIMATE_ACTION_FAN) {
|
if (this->action == climate::CLIMATE_ACTION_FAN) {
|
||||||
if (this->supports_fan_only_action_uses_fan_mode_timer_) {
|
if (this->supports_fan_only_action_uses_fan_mode_timer_) {
|
||||||
this->start_timer_(thermostat::TIMER_FAN_MODE);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_FAN_MODE);
|
||||||
} else {
|
} else {
|
||||||
this->start_timer_(thermostat::TIMER_FANNING_OFF);
|
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::TIMER_HEATING_OFF);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_HEATING_OFF);
|
||||||
// trig = this->idle_action_trigger_;
|
// trig = this->idle_action_trigger_;
|
||||||
ESP_LOGVV(TAG, "Switching to IDLE/OFF action");
|
ESP_LOGVV(TAG, "Switching to IDLE/OFF action");
|
||||||
this->cooling_max_runtime_exceeded_ = false;
|
this->cooling_max_runtime_exceeded_ = false;
|
||||||
@@ -465,10 +466,10 @@ void ThermostatClimate::switch_to_action_(climate::ClimateAction action, bool pu
|
|||||||
break;
|
break;
|
||||||
case climate::CLIMATE_ACTION_COOLING:
|
case climate::CLIMATE_ACTION_COOLING:
|
||||||
if (this->cooling_action_ready_()) {
|
if (this->cooling_action_ready_()) {
|
||||||
this->start_timer_(thermostat::TIMER_COOLING_ON);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_COOLING_ON);
|
||||||
this->start_timer_(thermostat::TIMER_COOLING_MAX_RUN_TIME);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_COOLING_MAX_RUN_TIME);
|
||||||
if (this->supports_fan_with_cooling_) {
|
if (this->supports_fan_with_cooling_) {
|
||||||
this->start_timer_(thermostat::TIMER_FANNING_ON);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_FANNING_ON);
|
||||||
trig_fan = this->fan_only_action_trigger_;
|
trig_fan = this->fan_only_action_trigger_;
|
||||||
}
|
}
|
||||||
this->cooling_max_runtime_exceeded_ = false;
|
this->cooling_max_runtime_exceeded_ = false;
|
||||||
@@ -479,10 +480,10 @@ void ThermostatClimate::switch_to_action_(climate::ClimateAction action, bool pu
|
|||||||
break;
|
break;
|
||||||
case climate::CLIMATE_ACTION_HEATING:
|
case climate::CLIMATE_ACTION_HEATING:
|
||||||
if (this->heating_action_ready_()) {
|
if (this->heating_action_ready_()) {
|
||||||
this->start_timer_(thermostat::TIMER_HEATING_ON);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_HEATING_ON);
|
||||||
this->start_timer_(thermostat::TIMER_HEATING_MAX_RUN_TIME);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_HEATING_MAX_RUN_TIME);
|
||||||
if (this->supports_fan_with_heating_) {
|
if (this->supports_fan_with_heating_) {
|
||||||
this->start_timer_(thermostat::TIMER_FANNING_ON);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_FANNING_ON);
|
||||||
trig_fan = this->fan_only_action_trigger_;
|
trig_fan = this->fan_only_action_trigger_;
|
||||||
}
|
}
|
||||||
this->heating_max_runtime_exceeded_ = false;
|
this->heating_max_runtime_exceeded_ = false;
|
||||||
@@ -494,9 +495,9 @@ void ThermostatClimate::switch_to_action_(climate::ClimateAction action, bool pu
|
|||||||
case climate::CLIMATE_ACTION_FAN:
|
case climate::CLIMATE_ACTION_FAN:
|
||||||
if (this->fanning_action_ready_()) {
|
if (this->fanning_action_ready_()) {
|
||||||
if (this->supports_fan_only_action_uses_fan_mode_timer_) {
|
if (this->supports_fan_only_action_uses_fan_mode_timer_) {
|
||||||
this->start_timer_(thermostat::TIMER_FAN_MODE);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_FAN_MODE);
|
||||||
} else {
|
} else {
|
||||||
this->start_timer_(thermostat::TIMER_FANNING_ON);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_FANNING_ON);
|
||||||
}
|
}
|
||||||
trig = this->fan_only_action_trigger_;
|
trig = this->fan_only_action_trigger_;
|
||||||
ESP_LOGVV(TAG, "Switching to FAN_ONLY action");
|
ESP_LOGVV(TAG, "Switching to FAN_ONLY action");
|
||||||
@@ -505,8 +506,8 @@ void ThermostatClimate::switch_to_action_(climate::ClimateAction action, bool pu
|
|||||||
break;
|
break;
|
||||||
case climate::CLIMATE_ACTION_DRYING:
|
case climate::CLIMATE_ACTION_DRYING:
|
||||||
if (this->drying_action_ready_()) {
|
if (this->drying_action_ready_()) {
|
||||||
this->start_timer_(thermostat::TIMER_COOLING_ON);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_COOLING_ON);
|
||||||
this->start_timer_(thermostat::TIMER_FANNING_ON);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_FANNING_ON);
|
||||||
trig = this->dry_action_trigger_;
|
trig = this->dry_action_trigger_;
|
||||||
ESP_LOGVV(TAG, "Switching to DRYING action");
|
ESP_LOGVV(TAG, "Switching to DRYING action");
|
||||||
action_ready = true;
|
action_ready = true;
|
||||||
@@ -549,14 +550,14 @@ void ThermostatClimate::switch_to_supplemental_action_(climate::ClimateAction ac
|
|||||||
switch (action) {
|
switch (action) {
|
||||||
case climate::CLIMATE_ACTION_OFF:
|
case climate::CLIMATE_ACTION_OFF:
|
||||||
case climate::CLIMATE_ACTION_IDLE:
|
case climate::CLIMATE_ACTION_IDLE:
|
||||||
this->cancel_timer_(thermostat::TIMER_COOLING_MAX_RUN_TIME);
|
this->cancel_timer_(thermostat::THERMOSTAT_TIMER_COOLING_MAX_RUN_TIME);
|
||||||
this->cancel_timer_(thermostat::TIMER_HEATING_MAX_RUN_TIME);
|
this->cancel_timer_(thermostat::THERMOSTAT_TIMER_HEATING_MAX_RUN_TIME);
|
||||||
break;
|
break;
|
||||||
case climate::CLIMATE_ACTION_COOLING:
|
case climate::CLIMATE_ACTION_COOLING:
|
||||||
this->cancel_timer_(thermostat::TIMER_COOLING_MAX_RUN_TIME);
|
this->cancel_timer_(thermostat::THERMOSTAT_TIMER_COOLING_MAX_RUN_TIME);
|
||||||
break;
|
break;
|
||||||
case climate::CLIMATE_ACTION_HEATING:
|
case climate::CLIMATE_ACTION_HEATING:
|
||||||
this->cancel_timer_(thermostat::TIMER_HEATING_MAX_RUN_TIME);
|
this->cancel_timer_(thermostat::THERMOSTAT_TIMER_HEATING_MAX_RUN_TIME);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@@ -571,15 +572,15 @@ void ThermostatClimate::trigger_supplemental_action_() {
|
|||||||
|
|
||||||
switch (this->supplemental_action_) {
|
switch (this->supplemental_action_) {
|
||||||
case climate::CLIMATE_ACTION_COOLING:
|
case climate::CLIMATE_ACTION_COOLING:
|
||||||
if (!this->timer_active_(thermostat::TIMER_COOLING_MAX_RUN_TIME)) {
|
if (!this->timer_active_(thermostat::THERMOSTAT_TIMER_COOLING_MAX_RUN_TIME)) {
|
||||||
this->start_timer_(thermostat::TIMER_COOLING_MAX_RUN_TIME);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_COOLING_MAX_RUN_TIME);
|
||||||
}
|
}
|
||||||
trig = this->supplemental_cool_action_trigger_;
|
trig = this->supplemental_cool_action_trigger_;
|
||||||
ESP_LOGVV(TAG, "Calling supplemental COOLING action");
|
ESP_LOGVV(TAG, "Calling supplemental COOLING action");
|
||||||
break;
|
break;
|
||||||
case climate::CLIMATE_ACTION_HEATING:
|
case climate::CLIMATE_ACTION_HEATING:
|
||||||
if (!this->timer_active_(thermostat::TIMER_HEATING_MAX_RUN_TIME)) {
|
if (!this->timer_active_(thermostat::THERMOSTAT_TIMER_HEATING_MAX_RUN_TIME)) {
|
||||||
this->start_timer_(thermostat::TIMER_HEATING_MAX_RUN_TIME);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_HEATING_MAX_RUN_TIME);
|
||||||
}
|
}
|
||||||
trig = this->supplemental_heat_action_trigger_;
|
trig = this->supplemental_heat_action_trigger_;
|
||||||
ESP_LOGVV(TAG, "Calling supplemental HEATING action");
|
ESP_LOGVV(TAG, "Calling supplemental HEATING action");
|
||||||
@@ -657,7 +658,7 @@ void ThermostatClimate::switch_to_fan_mode_(climate::ClimateFanMode fan_mode, bo
|
|||||||
this->prev_fan_mode_trigger_->stop_action();
|
this->prev_fan_mode_trigger_->stop_action();
|
||||||
this->prev_fan_mode_trigger_ = nullptr;
|
this->prev_fan_mode_trigger_ = nullptr;
|
||||||
}
|
}
|
||||||
this->start_timer_(thermostat::TIMER_FAN_MODE);
|
this->start_timer_(thermostat::THERMOSTAT_TIMER_FAN_MODE);
|
||||||
if (trig != nullptr) {
|
if (trig != nullptr) {
|
||||||
trig->trigger();
|
trig->trigger();
|
||||||
}
|
}
|
||||||
@@ -758,35 +759,44 @@ void ThermostatClimate::switch_to_swing_mode_(climate::ClimateSwingMode swing_mo
|
|||||||
|
|
||||||
bool ThermostatClimate::idle_action_ready_() {
|
bool ThermostatClimate::idle_action_ready_() {
|
||||||
if (this->supports_fan_only_action_uses_fan_mode_timer_) {
|
if (this->supports_fan_only_action_uses_fan_mode_timer_) {
|
||||||
return !(this->timer_active_(thermostat::TIMER_COOLING_ON) || this->timer_active_(thermostat::TIMER_FAN_MODE) ||
|
return !(this->timer_active_(thermostat::THERMOSTAT_TIMER_COOLING_ON) ||
|
||||||
this->timer_active_(thermostat::TIMER_HEATING_ON));
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_FAN_MODE) ||
|
||||||
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_HEATING_ON));
|
||||||
}
|
}
|
||||||
return !(this->timer_active_(thermostat::TIMER_COOLING_ON) || this->timer_active_(thermostat::TIMER_FANNING_ON) ||
|
return !(this->timer_active_(thermostat::THERMOSTAT_TIMER_COOLING_ON) ||
|
||||||
this->timer_active_(thermostat::TIMER_HEATING_ON));
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_FANNING_ON) ||
|
||||||
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_HEATING_ON));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThermostatClimate::cooling_action_ready_() {
|
bool ThermostatClimate::cooling_action_ready_() {
|
||||||
return !(this->timer_active_(thermostat::TIMER_IDLE_ON) || this->timer_active_(thermostat::TIMER_FANNING_OFF) ||
|
return !(this->timer_active_(thermostat::THERMOSTAT_TIMER_IDLE_ON) ||
|
||||||
this->timer_active_(thermostat::TIMER_COOLING_OFF) || this->timer_active_(thermostat::TIMER_HEATING_ON));
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_FANNING_OFF) ||
|
||||||
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_COOLING_OFF) ||
|
||||||
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_HEATING_ON));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThermostatClimate::drying_action_ready_() {
|
bool ThermostatClimate::drying_action_ready_() {
|
||||||
return !(this->timer_active_(thermostat::TIMER_IDLE_ON) || this->timer_active_(thermostat::TIMER_FANNING_OFF) ||
|
return !(this->timer_active_(thermostat::THERMOSTAT_TIMER_IDLE_ON) ||
|
||||||
this->timer_active_(thermostat::TIMER_COOLING_OFF) || this->timer_active_(thermostat::TIMER_HEATING_ON));
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_FANNING_OFF) ||
|
||||||
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_COOLING_OFF) ||
|
||||||
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_HEATING_ON));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThermostatClimate::fan_mode_ready_() { return !(this->timer_active_(thermostat::TIMER_FAN_MODE)); }
|
bool ThermostatClimate::fan_mode_ready_() { return !(this->timer_active_(thermostat::THERMOSTAT_TIMER_FAN_MODE)); }
|
||||||
|
|
||||||
bool ThermostatClimate::fanning_action_ready_() {
|
bool ThermostatClimate::fanning_action_ready_() {
|
||||||
if (this->supports_fan_only_action_uses_fan_mode_timer_) {
|
if (this->supports_fan_only_action_uses_fan_mode_timer_) {
|
||||||
return !(this->timer_active_(thermostat::TIMER_FAN_MODE));
|
return !(this->timer_active_(thermostat::THERMOSTAT_TIMER_FAN_MODE));
|
||||||
}
|
}
|
||||||
return !(this->timer_active_(thermostat::TIMER_IDLE_ON) || this->timer_active_(thermostat::TIMER_FANNING_OFF));
|
return !(this->timer_active_(thermostat::THERMOSTAT_TIMER_IDLE_ON) ||
|
||||||
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_FANNING_OFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThermostatClimate::heating_action_ready_() {
|
bool ThermostatClimate::heating_action_ready_() {
|
||||||
return !(this->timer_active_(thermostat::TIMER_IDLE_ON) || this->timer_active_(thermostat::TIMER_COOLING_ON) ||
|
return !(this->timer_active_(thermostat::THERMOSTAT_TIMER_IDLE_ON) ||
|
||||||
this->timer_active_(thermostat::TIMER_FANNING_OFF) || this->timer_active_(thermostat::TIMER_HEATING_OFF));
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_COOLING_ON) ||
|
||||||
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_FANNING_OFF) ||
|
||||||
|
this->timer_active_(thermostat::THERMOSTAT_TIMER_HEATING_OFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermostatClimate::start_timer_(const ThermostatClimateTimerIndex timer_index) {
|
void ThermostatClimate::start_timer_(const ThermostatClimateTimerIndex timer_index) {
|
||||||
@@ -1162,43 +1172,43 @@ void ThermostatClimate::set_heat_overrun(float overrun) { this->heating_overrun_
|
|||||||
void ThermostatClimate::set_supplemental_cool_delta(float delta) { this->supplemental_cool_delta_ = delta; }
|
void ThermostatClimate::set_supplemental_cool_delta(float delta) { this->supplemental_cool_delta_ = delta; }
|
||||||
void ThermostatClimate::set_supplemental_heat_delta(float delta) { this->supplemental_heat_delta_ = delta; }
|
void ThermostatClimate::set_supplemental_heat_delta(float delta) { this->supplemental_heat_delta_ = delta; }
|
||||||
void ThermostatClimate::set_cooling_maximum_run_time_in_sec(uint32_t time) {
|
void ThermostatClimate::set_cooling_maximum_run_time_in_sec(uint32_t time) {
|
||||||
this->timer_[thermostat::TIMER_COOLING_MAX_RUN_TIME].time =
|
this->timer_[thermostat::THERMOSTAT_TIMER_COOLING_MAX_RUN_TIME].time =
|
||||||
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
||||||
}
|
}
|
||||||
void ThermostatClimate::set_cooling_minimum_off_time_in_sec(uint32_t time) {
|
void ThermostatClimate::set_cooling_minimum_off_time_in_sec(uint32_t time) {
|
||||||
this->timer_[thermostat::TIMER_COOLING_OFF].time =
|
this->timer_[thermostat::THERMOSTAT_TIMER_COOLING_OFF].time =
|
||||||
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
||||||
}
|
}
|
||||||
void ThermostatClimate::set_cooling_minimum_run_time_in_sec(uint32_t time) {
|
void ThermostatClimate::set_cooling_minimum_run_time_in_sec(uint32_t time) {
|
||||||
this->timer_[thermostat::TIMER_COOLING_ON].time =
|
this->timer_[thermostat::THERMOSTAT_TIMER_COOLING_ON].time =
|
||||||
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
||||||
}
|
}
|
||||||
void ThermostatClimate::set_fan_mode_minimum_switching_time_in_sec(uint32_t time) {
|
void ThermostatClimate::set_fan_mode_minimum_switching_time_in_sec(uint32_t time) {
|
||||||
this->timer_[thermostat::TIMER_FAN_MODE].time =
|
this->timer_[thermostat::THERMOSTAT_TIMER_FAN_MODE].time =
|
||||||
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
||||||
}
|
}
|
||||||
void ThermostatClimate::set_fanning_minimum_off_time_in_sec(uint32_t time) {
|
void ThermostatClimate::set_fanning_minimum_off_time_in_sec(uint32_t time) {
|
||||||
this->timer_[thermostat::TIMER_FANNING_OFF].time =
|
this->timer_[thermostat::THERMOSTAT_TIMER_FANNING_OFF].time =
|
||||||
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
||||||
}
|
}
|
||||||
void ThermostatClimate::set_fanning_minimum_run_time_in_sec(uint32_t time) {
|
void ThermostatClimate::set_fanning_minimum_run_time_in_sec(uint32_t time) {
|
||||||
this->timer_[thermostat::TIMER_FANNING_ON].time =
|
this->timer_[thermostat::THERMOSTAT_TIMER_FANNING_ON].time =
|
||||||
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
||||||
}
|
}
|
||||||
void ThermostatClimate::set_heating_maximum_run_time_in_sec(uint32_t time) {
|
void ThermostatClimate::set_heating_maximum_run_time_in_sec(uint32_t time) {
|
||||||
this->timer_[thermostat::TIMER_HEATING_MAX_RUN_TIME].time =
|
this->timer_[thermostat::THERMOSTAT_TIMER_HEATING_MAX_RUN_TIME].time =
|
||||||
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
||||||
}
|
}
|
||||||
void ThermostatClimate::set_heating_minimum_off_time_in_sec(uint32_t time) {
|
void ThermostatClimate::set_heating_minimum_off_time_in_sec(uint32_t time) {
|
||||||
this->timer_[thermostat::TIMER_HEATING_OFF].time =
|
this->timer_[thermostat::THERMOSTAT_TIMER_HEATING_OFF].time =
|
||||||
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
||||||
}
|
}
|
||||||
void ThermostatClimate::set_heating_minimum_run_time_in_sec(uint32_t time) {
|
void ThermostatClimate::set_heating_minimum_run_time_in_sec(uint32_t time) {
|
||||||
this->timer_[thermostat::TIMER_HEATING_ON].time =
|
this->timer_[thermostat::THERMOSTAT_TIMER_HEATING_ON].time =
|
||||||
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
||||||
}
|
}
|
||||||
void ThermostatClimate::set_idle_minimum_time_in_sec(uint32_t time) {
|
void ThermostatClimate::set_idle_minimum_time_in_sec(uint32_t time) {
|
||||||
this->timer_[thermostat::TIMER_IDLE_ON].time =
|
this->timer_[thermostat::THERMOSTAT_TIMER_IDLE_ON].time =
|
||||||
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
1000 * (time < this->min_timer_duration_ ? this->min_timer_duration_ : time);
|
||||||
}
|
}
|
||||||
void ThermostatClimate::set_sensor(sensor::Sensor *sensor) { this->sensor_ = sensor; }
|
void ThermostatClimate::set_sensor(sensor::Sensor *sensor) { this->sensor_ = sensor; }
|
||||||
@@ -1327,13 +1337,14 @@ void ThermostatClimate::dump_config() {
|
|||||||
" Minimum Off Time: %" PRIu32 "s\n"
|
" Minimum Off Time: %" PRIu32 "s\n"
|
||||||
" Minimum Run Time: %" PRIu32 "s",
|
" Minimum Run Time: %" PRIu32 "s",
|
||||||
this->cooling_deadband_, this->cooling_overrun_,
|
this->cooling_deadband_, this->cooling_overrun_,
|
||||||
this->timer_duration_(thermostat::TIMER_COOLING_OFF) / 1000,
|
this->timer_duration_(thermostat::THERMOSTAT_TIMER_COOLING_OFF) / 1000,
|
||||||
this->timer_duration_(thermostat::TIMER_COOLING_ON) / 1000);
|
this->timer_duration_(thermostat::THERMOSTAT_TIMER_COOLING_ON) / 1000);
|
||||||
if ((this->supplemental_cool_delta_ > 0) || (this->timer_duration_(thermostat::TIMER_COOLING_MAX_RUN_TIME) > 0)) {
|
if ((this->supplemental_cool_delta_ > 0) ||
|
||||||
|
(this->timer_duration_(thermostat::THERMOSTAT_TIMER_COOLING_MAX_RUN_TIME) > 0)) {
|
||||||
ESP_LOGCONFIG(TAG,
|
ESP_LOGCONFIG(TAG,
|
||||||
" Maximum Run Time: %" PRIu32 "s\n"
|
" Maximum Run Time: %" PRIu32 "s\n"
|
||||||
" Supplemental Delta: %.1f°C",
|
" Supplemental Delta: %.1f°C",
|
||||||
this->timer_duration_(thermostat::TIMER_COOLING_MAX_RUN_TIME) / 1000,
|
this->timer_duration_(thermostat::THERMOSTAT_TIMER_COOLING_MAX_RUN_TIME) / 1000,
|
||||||
this->supplemental_cool_delta_);
|
this->supplemental_cool_delta_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1345,13 +1356,14 @@ void ThermostatClimate::dump_config() {
|
|||||||
" Minimum Off Time: %" PRIu32 "s\n"
|
" Minimum Off Time: %" PRIu32 "s\n"
|
||||||
" Minimum Run Time: %" PRIu32 "s",
|
" Minimum Run Time: %" PRIu32 "s",
|
||||||
this->heating_deadband_, this->heating_overrun_,
|
this->heating_deadband_, this->heating_overrun_,
|
||||||
this->timer_duration_(thermostat::TIMER_HEATING_OFF) / 1000,
|
this->timer_duration_(thermostat::THERMOSTAT_TIMER_HEATING_OFF) / 1000,
|
||||||
this->timer_duration_(thermostat::TIMER_HEATING_ON) / 1000);
|
this->timer_duration_(thermostat::THERMOSTAT_TIMER_HEATING_ON) / 1000);
|
||||||
if ((this->supplemental_heat_delta_ > 0) || (this->timer_duration_(thermostat::TIMER_HEATING_MAX_RUN_TIME) > 0)) {
|
if ((this->supplemental_heat_delta_ > 0) ||
|
||||||
|
(this->timer_duration_(thermostat::THERMOSTAT_TIMER_HEATING_MAX_RUN_TIME) > 0)) {
|
||||||
ESP_LOGCONFIG(TAG,
|
ESP_LOGCONFIG(TAG,
|
||||||
" Maximum Run Time: %" PRIu32 "s\n"
|
" Maximum Run Time: %" PRIu32 "s\n"
|
||||||
" Supplemental Delta: %.1f°C",
|
" Supplemental Delta: %.1f°C",
|
||||||
this->timer_duration_(thermostat::TIMER_HEATING_MAX_RUN_TIME) / 1000,
|
this->timer_duration_(thermostat::THERMOSTAT_TIMER_HEATING_MAX_RUN_TIME) / 1000,
|
||||||
this->supplemental_heat_delta_);
|
this->supplemental_heat_delta_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1360,15 +1372,15 @@ void ThermostatClimate::dump_config() {
|
|||||||
" Fan Parameters:\n"
|
" Fan Parameters:\n"
|
||||||
" Minimum Off Time: %" PRIu32 "s\n"
|
" Minimum Off Time: %" PRIu32 "s\n"
|
||||||
" Minimum Run Time: %" PRIu32 "s",
|
" Minimum Run Time: %" PRIu32 "s",
|
||||||
this->timer_duration_(thermostat::TIMER_FANNING_OFF) / 1000,
|
this->timer_duration_(thermostat::THERMOSTAT_TIMER_FANNING_OFF) / 1000,
|
||||||
this->timer_duration_(thermostat::TIMER_FANNING_ON) / 1000);
|
this->timer_duration_(thermostat::THERMOSTAT_TIMER_FANNING_ON) / 1000);
|
||||||
}
|
}
|
||||||
if (this->supports_fan_mode_on_ || this->supports_fan_mode_off_ || this->supports_fan_mode_auto_ ||
|
if (this->supports_fan_mode_on_ || this->supports_fan_mode_off_ || this->supports_fan_mode_auto_ ||
|
||||||
this->supports_fan_mode_low_ || this->supports_fan_mode_medium_ || this->supports_fan_mode_high_ ||
|
this->supports_fan_mode_low_ || this->supports_fan_mode_medium_ || this->supports_fan_mode_high_ ||
|
||||||
this->supports_fan_mode_middle_ || this->supports_fan_mode_focus_ || this->supports_fan_mode_diffuse_ ||
|
this->supports_fan_mode_middle_ || this->supports_fan_mode_focus_ || this->supports_fan_mode_diffuse_ ||
|
||||||
this->supports_fan_mode_quiet_) {
|
this->supports_fan_mode_quiet_) {
|
||||||
ESP_LOGCONFIG(TAG, " Minimum Fan Mode Switching Time: %" PRIu32 "s",
|
ESP_LOGCONFIG(TAG, " Minimum Fan Mode Switching Time: %" PRIu32 "s",
|
||||||
this->timer_duration_(thermostat::TIMER_FAN_MODE) / 1000);
|
this->timer_duration_(thermostat::THERMOSTAT_TIMER_FAN_MODE) / 1000);
|
||||||
}
|
}
|
||||||
ESP_LOGCONFIG(TAG,
|
ESP_LOGCONFIG(TAG,
|
||||||
" Minimum Idle Time: %" PRIu32 "s\n"
|
" Minimum Idle Time: %" PRIu32 "s\n"
|
||||||
@@ -1381,7 +1393,7 @@ void ThermostatClimate::dump_config() {
|
|||||||
" FAN_ONLY: %s\n"
|
" FAN_ONLY: %s\n"
|
||||||
" FAN_ONLY_ACTION_USES_FAN_MODE_TIMER: %s\n"
|
" FAN_ONLY_ACTION_USES_FAN_MODE_TIMER: %s\n"
|
||||||
" FAN_ONLY_COOLING: %s",
|
" FAN_ONLY_COOLING: %s",
|
||||||
this->timer_[thermostat::TIMER_IDLE_ON].time / 1000, YESNO(this->supports_auto_),
|
this->timer_[thermostat::THERMOSTAT_TIMER_IDLE_ON].time / 1000, YESNO(this->supports_auto_),
|
||||||
YESNO(this->supports_heat_cool_), YESNO(this->supports_heat_), YESNO(this->supports_cool_),
|
YESNO(this->supports_heat_cool_), YESNO(this->supports_heat_), YESNO(this->supports_cool_),
|
||||||
YESNO(this->supports_dry_), YESNO(this->supports_fan_only_),
|
YESNO(this->supports_dry_), YESNO(this->supports_fan_only_),
|
||||||
YESNO(this->supports_fan_only_action_uses_fan_mode_timer_), YESNO(this->supports_fan_only_cooling_));
|
YESNO(this->supports_fan_only_action_uses_fan_mode_timer_), YESNO(this->supports_fan_only_cooling_));
|
||||||
|
@@ -14,17 +14,17 @@ namespace esphome {
|
|||||||
namespace thermostat {
|
namespace thermostat {
|
||||||
|
|
||||||
enum ThermostatClimateTimerIndex : uint8_t {
|
enum ThermostatClimateTimerIndex : uint8_t {
|
||||||
TIMER_COOLING_MAX_RUN_TIME = 0,
|
THERMOSTAT_TIMER_COOLING_MAX_RUN_TIME = 0,
|
||||||
TIMER_COOLING_OFF = 1,
|
THERMOSTAT_TIMER_COOLING_OFF = 1,
|
||||||
TIMER_COOLING_ON = 2,
|
THERMOSTAT_TIMER_COOLING_ON = 2,
|
||||||
TIMER_FAN_MODE = 3,
|
THERMOSTAT_TIMER_FAN_MODE = 3,
|
||||||
TIMER_FANNING_OFF = 4,
|
THERMOSTAT_TIMER_FANNING_OFF = 4,
|
||||||
TIMER_FANNING_ON = 5,
|
THERMOSTAT_TIMER_FANNING_ON = 5,
|
||||||
TIMER_HEATING_MAX_RUN_TIME = 6,
|
THERMOSTAT_TIMER_HEATING_MAX_RUN_TIME = 6,
|
||||||
TIMER_HEATING_OFF = 7,
|
THERMOSTAT_TIMER_HEATING_OFF = 7,
|
||||||
TIMER_HEATING_ON = 8,
|
THERMOSTAT_TIMER_HEATING_ON = 8,
|
||||||
TIMER_IDLE_ON = 9,
|
THERMOSTAT_TIMER_IDLE_ON = 9,
|
||||||
TIMER_COUNT = 10,
|
THERMOSTAT_TIMER_COUNT = 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum OnBootRestoreFrom : uint8_t {
|
enum OnBootRestoreFrom : uint8_t {
|
||||||
@@ -467,7 +467,7 @@ class ThermostatClimate : public climate::Climate, public Component {
|
|||||||
std::string default_custom_preset_{};
|
std::string default_custom_preset_{};
|
||||||
|
|
||||||
/// Climate action timers
|
/// Climate action timers
|
||||||
std::array<ThermostatClimateTimer, TIMER_COUNT> timer_{
|
std::array<ThermostatClimateTimer, THERMOSTAT_TIMER_COUNT> timer_{
|
||||||
ThermostatClimateTimer(false, 0, 0, std::bind(&ThermostatClimate::cooling_max_run_time_timer_callback_, this)),
|
ThermostatClimateTimer(false, 0, 0, std::bind(&ThermostatClimate::cooling_max_run_time_timer_callback_, this)),
|
||||||
ThermostatClimateTimer(false, 0, 0, std::bind(&ThermostatClimate::cooling_off_timer_callback_, this)),
|
ThermostatClimateTimer(false, 0, 0, std::bind(&ThermostatClimate::cooling_off_timer_callback_, this)),
|
||||||
ThermostatClimateTimer(false, 0, 0, std::bind(&ThermostatClimate::cooling_on_timer_callback_, this)),
|
ThermostatClimateTimer(false, 0, 0, std::bind(&ThermostatClimate::cooling_on_timer_callback_, this)),
|
||||||
|
Reference in New Issue
Block a user