mirror of
https://github.com/esphome/esphome.git
synced 2025-10-01 17:42:22 +01:00
Replace CLIMATE_MODE_AUTO with CLIMATE_MODE_HEAT_COOL in most cases (#1933)
This commit is contained in:
@@ -227,7 +227,7 @@ async def to_code(config):
|
||||
await cg.register_component(var, config)
|
||||
await climate.register_climate(var, config)
|
||||
|
||||
auto_mode_available = CONF_HEAT_ACTION in config and CONF_COOL_ACTION in config
|
||||
heat_cool_mode_available = CONF_HEAT_ACTION in config and CONF_COOL_ACTION in config
|
||||
two_points_available = CONF_HEAT_ACTION in config and (
|
||||
CONF_COOL_ACTION in config or CONF_FAN_ONLY_ACTION in config
|
||||
)
|
||||
@@ -258,10 +258,10 @@ async def to_code(config):
|
||||
var.get_idle_action_trigger(), [], config[CONF_IDLE_ACTION]
|
||||
)
|
||||
|
||||
if auto_mode_available is True:
|
||||
cg.add(var.set_supports_auto(True))
|
||||
if heat_cool_mode_available is True:
|
||||
cg.add(var.set_supports_heat_cool(True))
|
||||
else:
|
||||
cg.add(var.set_supports_auto(False))
|
||||
cg.add(var.set_supports_heat_cool(False))
|
||||
|
||||
if CONF_COOL_ACTION in config:
|
||||
await automation.build_automation(
|
||||
|
@@ -21,7 +21,7 @@ void ThermostatClimate::setup() {
|
||||
restore->to_call(this).perform();
|
||||
} else {
|
||||
// restore from defaults, change_away handles temps for us
|
||||
this->mode = climate::CLIMATE_MODE_AUTO;
|
||||
this->mode = climate::CLIMATE_MODE_HEAT_COOL;
|
||||
this->change_away_(false);
|
||||
}
|
||||
// refresh the climate action based on the restored settings
|
||||
@@ -79,6 +79,7 @@ climate::ClimateTraits ThermostatClimate::traits() {
|
||||
auto traits = climate::ClimateTraits();
|
||||
traits.set_supports_current_temperature(true);
|
||||
traits.set_supports_auto_mode(this->supports_auto_);
|
||||
traits.set_supports_heat_cool_mode(this->supports_heat_cool_);
|
||||
traits.set_supports_cool_mode(this->supports_cool_);
|
||||
traits.set_supports_dry_mode(this->supports_dry_);
|
||||
traits.set_supports_fan_only_mode(this->supports_fan_only_);
|
||||
@@ -130,7 +131,7 @@ climate::ClimateAction ThermostatClimate::compute_action_() {
|
||||
case climate::CLIMATE_MODE_OFF:
|
||||
target_action = climate::CLIMATE_ACTION_OFF;
|
||||
break;
|
||||
case climate::CLIMATE_MODE_AUTO:
|
||||
case climate::CLIMATE_MODE_HEAT_COOL:
|
||||
case climate::CLIMATE_MODE_COOL:
|
||||
case climate::CLIMATE_MODE_HEAT:
|
||||
if (this->supports_cool_) {
|
||||
@@ -321,7 +322,7 @@ void ThermostatClimate::switch_to_mode_(climate::ClimateMode mode) {
|
||||
case climate::CLIMATE_MODE_OFF:
|
||||
trig = this->off_mode_trigger_;
|
||||
break;
|
||||
case climate::CLIMATE_MODE_AUTO:
|
||||
case climate::CLIMATE_MODE_HEAT_COOL:
|
||||
// trig = this->auto_mode_trigger_;
|
||||
break;
|
||||
case climate::CLIMATE_MODE_COOL:
|
||||
@@ -339,7 +340,7 @@ void ThermostatClimate::switch_to_mode_(climate::ClimateMode mode) {
|
||||
default:
|
||||
// we cannot report an invalid mode back to HA (even if it asked for one)
|
||||
// and must assume some valid value
|
||||
mode = climate::CLIMATE_MODE_AUTO;
|
||||
mode = climate::CLIMATE_MODE_HEAT_COOL;
|
||||
// trig = this->auto_mode_trigger_;
|
||||
}
|
||||
assert(trig != nullptr);
|
||||
@@ -434,6 +435,9 @@ ThermostatClimate::ThermostatClimate()
|
||||
swing_mode_vertical_trigger_(new Trigger<>()) {}
|
||||
void ThermostatClimate::set_hysteresis(float hysteresis) { this->hysteresis_ = hysteresis; }
|
||||
void ThermostatClimate::set_sensor(sensor::Sensor *sensor) { this->sensor_ = sensor; }
|
||||
void ThermostatClimate::set_supports_heat_cool(bool supports_heat_cool) {
|
||||
this->supports_heat_cool_ = supports_heat_cool;
|
||||
}
|
||||
void ThermostatClimate::set_supports_auto(bool supports_auto) { this->supports_auto_ = supports_auto; }
|
||||
void ThermostatClimate::set_supports_cool(bool supports_cool) { this->supports_cool_ = supports_cool; }
|
||||
void ThermostatClimate::set_supports_dry(bool supports_dry) { this->supports_dry_ = supports_dry; }
|
||||
@@ -521,6 +525,7 @@ void ThermostatClimate::dump_config() {
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Hysteresis: %.1f°C", this->hysteresis_);
|
||||
ESP_LOGCONFIG(TAG, " Supports AUTO: %s", YESNO(this->supports_auto_));
|
||||
ESP_LOGCONFIG(TAG, " Supports HEAT/COOL: %s", YESNO(this->supports_heat_cool_));
|
||||
ESP_LOGCONFIG(TAG, " Supports COOL: %s", YESNO(this->supports_cool_));
|
||||
ESP_LOGCONFIG(TAG, " Supports DRY: %s", YESNO(this->supports_dry_));
|
||||
ESP_LOGCONFIG(TAG, " Supports FAN_ONLY: %s", YESNO(this->supports_fan_only_));
|
||||
|
@@ -29,6 +29,7 @@ class ThermostatClimate : public climate::Climate, public Component {
|
||||
void set_hysteresis(float hysteresis);
|
||||
void set_sensor(sensor::Sensor *sensor);
|
||||
void set_supports_auto(bool supports_auto);
|
||||
void set_supports_heat_cool(bool supports_heat_cool);
|
||||
void set_supports_cool(bool supports_cool);
|
||||
void set_supports_dry(bool supports_dry);
|
||||
void set_supports_fan_only(bool supports_fan_only);
|
||||
@@ -113,6 +114,7 @@ class ThermostatClimate : public climate::Climate, public Component {
|
||||
/// A false value for any given attribute means that the controller has no such action
|
||||
/// (for example a thermostat, where only heating and not-heating is possible).
|
||||
bool supports_auto_{false};
|
||||
bool supports_heat_cool_{false};
|
||||
bool supports_cool_{false};
|
||||
bool supports_dry_{false};
|
||||
bool supports_fan_only_{false};
|
||||
|
Reference in New Issue
Block a user