mirror of
https://github.com/esphome/esphome.git
synced 2024-11-14 11:08:10 +01:00
bang_bang: respect set cool- and heat-only modes (#2926)
This commit is contained in:
parent
f5c3b3446f
commit
beb5f3dc9d
1 changed files with 8 additions and 6 deletions
|
@ -80,21 +80,23 @@ void BangBangClimate::compute_state_() {
|
||||||
|
|
||||||
climate::ClimateAction target_action;
|
climate::ClimateAction target_action;
|
||||||
if (too_cold) {
|
if (too_cold) {
|
||||||
// too cold -> enable heating if possible, else idle
|
// too cold -> enable heating if possible and enabled, else idle
|
||||||
if (this->supports_heat_)
|
if (this->supports_heat_ &&
|
||||||
|
(this->mode == climate::CLIMATE_MODE_HEAT_COOL || this->mode == climate::CLIMATE_MODE_HEAT))
|
||||||
target_action = climate::CLIMATE_ACTION_HEATING;
|
target_action = climate::CLIMATE_ACTION_HEATING;
|
||||||
else
|
else
|
||||||
target_action = climate::CLIMATE_ACTION_IDLE;
|
target_action = climate::CLIMATE_ACTION_IDLE;
|
||||||
} else if (too_hot) {
|
} else if (too_hot) {
|
||||||
// too hot -> enable cooling if possible, else idle
|
// too hot -> enable cooling if possible and enabled, else idle
|
||||||
if (this->supports_cool_)
|
if (this->supports_cool_ &&
|
||||||
|
(this->mode == climate::CLIMATE_MODE_HEAT_COOL || this->mode == climate::CLIMATE_MODE_COOL))
|
||||||
target_action = climate::CLIMATE_ACTION_COOLING;
|
target_action = climate::CLIMATE_ACTION_COOLING;
|
||||||
else
|
else
|
||||||
target_action = climate::CLIMATE_ACTION_IDLE;
|
target_action = climate::CLIMATE_ACTION_IDLE;
|
||||||
} else {
|
} else {
|
||||||
// neither too hot nor too cold -> in range
|
// neither too hot nor too cold -> in range
|
||||||
if (this->supports_cool_ && this->supports_heat_) {
|
if (this->supports_cool_ && this->supports_heat_ && this->mode == climate::CLIMATE_MODE_HEAT_COOL) {
|
||||||
// if supports both ends, go to idle action
|
// if supports both ends and both cooling and heating enabled, go to idle action
|
||||||
target_action = climate::CLIMATE_ACTION_IDLE;
|
target_action = climate::CLIMATE_ACTION_IDLE;
|
||||||
} else {
|
} else {
|
||||||
// else use current mode and don't change (hysteresis)
|
// else use current mode and don't change (hysteresis)
|
||||||
|
|
Loading…
Reference in a new issue