mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
Fix PID climate breaks when restoring old modes (#2086)
This commit is contained in:
parent
3ffa59f0cd
commit
29f0508dc2
2 changed files with 2 additions and 12 deletions
|
@ -37,7 +37,7 @@ void PIDClimate::control(const climate::ClimateCall &call) {
|
|||
|
||||
// If switching to off mode, set output immediately
|
||||
if (this->mode == climate::CLIMATE_MODE_OFF)
|
||||
this->handle_non_auto_mode_();
|
||||
this->write_output_(0.0f);
|
||||
|
||||
this->publish_state();
|
||||
}
|
||||
|
@ -98,15 +98,6 @@ void PIDClimate::write_output_(float value) {
|
|||
}
|
||||
this->pid_computed_callback_.call();
|
||||
}
|
||||
void PIDClimate::handle_non_auto_mode_() {
|
||||
// in non-auto mode, switch directly to appropriate action
|
||||
// - OFF mode -> Output at 0%
|
||||
if (this->mode == climate::CLIMATE_MODE_OFF) {
|
||||
this->write_output_(0.0);
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
void PIDClimate::update_pid_() {
|
||||
float value;
|
||||
if (isnan(this->current_temperature) || isnan(this->target_temperature)) {
|
||||
|
@ -135,7 +126,7 @@ void PIDClimate::update_pid_() {
|
|||
}
|
||||
|
||||
if (this->mode == climate::CLIMATE_MODE_OFF) {
|
||||
this->handle_non_auto_mode_();
|
||||
this->write_output_(0.0);
|
||||
} else {
|
||||
this->write_output_(value);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ class PIDClimate : public climate::Climate, public Component {
|
|||
bool supports_heat_() const { return this->heat_output_ != nullptr; }
|
||||
|
||||
void write_output_(float value);
|
||||
void handle_non_auto_mode_();
|
||||
|
||||
/// The sensor used for getting the current temperature
|
||||
sensor::Sensor *sensor_;
|
||||
|
|
Loading…
Reference in a new issue