mirror of
https://github.com/esphome/esphome.git
synced 2024-12-19 16:07:47 +01:00
Climate modes COOL and HEAT are auto modes (#1994)
This commit is contained in:
parent
7ae611256a
commit
cdbc146e5d
@ -20,7 +20,12 @@ void PIDClimate::setup() {
|
||||
restore->to_call(this).perform();
|
||||
} else {
|
||||
// restore from defaults, change_away handles those for us
|
||||
this->mode = climate::CLIMATE_MODE_HEAT_COOL;
|
||||
if (supports_heat_() && supports_cool_())
|
||||
this->mode = climate::CLIMATE_MODE_HEAT_COOL;
|
||||
else if (supports_cool_())
|
||||
this->mode = climate::CLIMATE_MODE_COOL;
|
||||
else if (supports_heat_())
|
||||
this->mode = climate::CLIMATE_MODE_HEAT;
|
||||
this->target_temperature = this->default_target_temperature_;
|
||||
}
|
||||
}
|
||||
@ -41,11 +46,13 @@ climate::ClimateTraits PIDClimate::traits() {
|
||||
traits.set_supports_current_temperature(true);
|
||||
traits.set_supports_two_point_target_temperature(false);
|
||||
|
||||
traits.set_supported_modes({climate::CLIMATE_MODE_OFF, climate::CLIMATE_MODE_HEAT_COOL});
|
||||
traits.set_supported_modes({climate::CLIMATE_MODE_OFF});
|
||||
if (supports_cool_())
|
||||
traits.add_supported_mode(climate::CLIMATE_MODE_COOL);
|
||||
if (supports_heat_())
|
||||
traits.add_supported_mode(climate::CLIMATE_MODE_HEAT);
|
||||
if (supports_heat_() && supports_cool_())
|
||||
traits.add_supported_mode(climate::CLIMATE_MODE_HEAT_COOL);
|
||||
|
||||
traits.set_supports_action(true);
|
||||
return traits;
|
||||
@ -93,13 +100,8 @@ void PIDClimate::write_output_(float value) {
|
||||
}
|
||||
void PIDClimate::handle_non_auto_mode_() {
|
||||
// in non-auto mode, switch directly to appropriate action
|
||||
// - HEAT mode / COOL mode -> Output at ±100%
|
||||
// - OFF mode -> Output at 0%
|
||||
if (this->mode == climate::CLIMATE_MODE_HEAT) {
|
||||
this->write_output_(1.0);
|
||||
} else if (this->mode == climate::CLIMATE_MODE_COOL) {
|
||||
this->write_output_(-1.0);
|
||||
} else if (this->mode == climate::CLIMATE_MODE_OFF) {
|
||||
if (this->mode == climate::CLIMATE_MODE_OFF) {
|
||||
this->write_output_(0.0);
|
||||
} else {
|
||||
assert(false);
|
||||
@ -132,7 +134,7 @@ void PIDClimate::update_pid_() {
|
||||
}
|
||||
}
|
||||
|
||||
if (this->mode != climate::CLIMATE_MODE_HEAT_COOL) {
|
||||
if (this->mode == climate::CLIMATE_MODE_OFF) {
|
||||
this->handle_non_auto_mode_();
|
||||
} else {
|
||||
this->write_output_(value);
|
||||
|
Loading…
Reference in New Issue
Block a user