mirror of
https://github.com/esphome/esphome.git
synced 2024-12-23 16:47:57 +01:00
Bang bang climate new mode meanings (#1996)
This commit is contained in:
parent
cc9f0b3f47
commit
551e9c6111
@ -21,7 +21,12 @@ void BangBangClimate::setup() {
|
|||||||
restore->to_call(this).perform();
|
restore->to_call(this).perform();
|
||||||
} else {
|
} else {
|
||||||
// restore from defaults, change_away handles those for us
|
// restore from defaults, change_away handles those for us
|
||||||
this->mode = climate::CLIMATE_MODE_HEAT_COOL;
|
if (supports_cool_ && supports_heat_)
|
||||||
|
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->change_away_(false);
|
this->change_away_(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,12 +48,13 @@ climate::ClimateTraits BangBangClimate::traits() {
|
|||||||
traits.set_supports_current_temperature(true);
|
traits.set_supports_current_temperature(true);
|
||||||
traits.set_supported_modes({
|
traits.set_supported_modes({
|
||||||
climate::CLIMATE_MODE_OFF,
|
climate::CLIMATE_MODE_OFF,
|
||||||
climate::CLIMATE_MODE_HEAT_COOL,
|
|
||||||
});
|
});
|
||||||
if (supports_cool_)
|
if (supports_cool_)
|
||||||
traits.add_supported_mode(climate::CLIMATE_MODE_COOL);
|
traits.add_supported_mode(climate::CLIMATE_MODE_COOL);
|
||||||
if (supports_heat_)
|
if (supports_heat_)
|
||||||
traits.add_supported_mode(climate::CLIMATE_MODE_HEAT);
|
traits.add_supported_mode(climate::CLIMATE_MODE_HEAT);
|
||||||
|
if (supports_cool_ && supports_heat_)
|
||||||
|
traits.add_supported_mode(climate::CLIMATE_MODE_HEAT_COOL);
|
||||||
traits.set_supports_two_point_target_temperature(true);
|
traits.set_supports_two_point_target_temperature(true);
|
||||||
if (supports_away_)
|
if (supports_away_)
|
||||||
traits.set_supported_presets({
|
traits.set_supported_presets({
|
||||||
@ -59,12 +65,8 @@ climate::ClimateTraits BangBangClimate::traits() {
|
|||||||
return traits;
|
return traits;
|
||||||
}
|
}
|
||||||
void BangBangClimate::compute_state_() {
|
void BangBangClimate::compute_state_() {
|
||||||
if (this->mode != climate::CLIMATE_MODE_HEAT_COOL) {
|
if (this->mode == climate::CLIMATE_MODE_OFF) {
|
||||||
// in non-auto mode, switch directly to appropriate action
|
this->switch_to_action_(climate::CLIMATE_ACTION_OFF);
|
||||||
// - HEAT mode -> HEATING action
|
|
||||||
// - COOL mode -> COOLING action
|
|
||||||
// - OFF mode -> OFF action (not IDLE!)
|
|
||||||
this->switch_to_action_(static_cast<climate::ClimateAction>(this->mode));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isnan(this->current_temperature) || isnan(this->target_temperature_low) || isnan(this->target_temperature_high)) {
|
if (isnan(this->current_temperature) || isnan(this->target_temperature_low) || isnan(this->target_temperature_high)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user