From a9908f0a94b3b185cd0bf54702a0f959b5c645c2 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 14 Apr 2020 00:56:50 -0700 Subject: [PATCH] Ecobee to use HVAC mode heat-cool instead of auto (#34193) --- homeassistant/components/ecobee/climate.py | 16 ++++++++-------- tests/components/ecobee/test_climate.py | 18 +++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/homeassistant/components/ecobee/climate.py b/homeassistant/components/ecobee/climate.py index 8c8961a153f..89f464452f8 100644 --- a/homeassistant/components/ecobee/climate.py +++ b/homeassistant/components/ecobee/climate.py @@ -15,9 +15,9 @@ from homeassistant.components.climate.const import ( CURRENT_HVAC_IDLE, FAN_AUTO, FAN_ON, - HVAC_MODE_AUTO, HVAC_MODE_COOL, HVAC_MODE_HEAT, + HVAC_MODE_HEAT_COOL, HVAC_MODE_OFF, PRESET_AWAY, PRESET_NONE, @@ -64,7 +64,7 @@ ECOBEE_HVAC_TO_HASS = collections.OrderedDict( [ ("heat", HVAC_MODE_HEAT), ("cool", HVAC_MODE_COOL), - ("auto", HVAC_MODE_AUTO), + ("auto", HVAC_MODE_HEAT_COOL), ("off", HVAC_MODE_OFF), ("auxHeatOnly", HVAC_MODE_HEAT), ] @@ -259,7 +259,7 @@ class Thermostat(ClimateDevice): self.thermostat = self.data.ecobee.get_thermostat(self.thermostat_index) self._name = self.thermostat["name"] self.vacation = None - self._last_active_hvac_mode = HVAC_MODE_AUTO + self._last_active_hvac_mode = HVAC_MODE_HEAT_COOL self._operation_list = [] if ( @@ -270,7 +270,7 @@ class Thermostat(ClimateDevice): if self.thermostat["settings"]["coolStages"]: self._operation_list.append(HVAC_MODE_COOL) if len(self._operation_list) == 2: - self._operation_list.insert(0, HVAC_MODE_AUTO) + self._operation_list.insert(0, HVAC_MODE_HEAT_COOL) self._operation_list.append(HVAC_MODE_OFF) self._preset_modes = { @@ -347,21 +347,21 @@ class Thermostat(ClimateDevice): @property def target_temperature_low(self): """Return the lower bound temperature we try to reach.""" - if self.hvac_mode == HVAC_MODE_AUTO: + if self.hvac_mode == HVAC_MODE_HEAT_COOL: return self.thermostat["runtime"]["desiredHeat"] / 10.0 return None @property def target_temperature_high(self): """Return the upper bound temperature we try to reach.""" - if self.hvac_mode == HVAC_MODE_AUTO: + if self.hvac_mode == HVAC_MODE_HEAT_COOL: return self.thermostat["runtime"]["desiredCool"] / 10.0 return None @property def target_temperature(self): """Return the temperature we try to reach.""" - if self.hvac_mode == HVAC_MODE_AUTO: + if self.hvac_mode == HVAC_MODE_HEAT_COOL: return None if self.hvac_mode == HVAC_MODE_HEAT: return self.thermostat["runtime"]["desiredHeat"] / 10.0 @@ -599,7 +599,7 @@ class Thermostat(ClimateDevice): high_temp = kwargs.get(ATTR_TARGET_TEMP_HIGH) temp = kwargs.get(ATTR_TEMPERATURE) - if self.hvac_mode == HVAC_MODE_AUTO and ( + if self.hvac_mode == HVAC_MODE_HEAT_COOL and ( low_temp is not None or high_temp is not None ): self.set_auto_temp_hold(low_temp, high_temp) diff --git a/tests/components/ecobee/test_climate.py b/tests/components/ecobee/test_climate.py index 63476a9b717..4e88d7083c4 100644 --- a/tests/components/ecobee/test_climate.py +++ b/tests/components/ecobee/test_climate.py @@ -107,25 +107,25 @@ class TestEcobee(unittest.TestCase): def test_hvac_mode(self): """Test current operation property.""" - assert "auto" == self.thermostat.hvac_mode + assert self.thermostat.hvac_mode == "heat_cool" self.ecobee["settings"]["hvacMode"] = "heat" - assert "heat" == self.thermostat.hvac_mode + assert self.thermostat.hvac_mode == "heat" self.ecobee["settings"]["hvacMode"] = "cool" - assert "cool" == self.thermostat.hvac_mode + assert self.thermostat.hvac_mode == "cool" self.ecobee["settings"]["hvacMode"] = "auxHeatOnly" - assert "heat" == self.thermostat.hvac_mode + assert self.thermostat.hvac_mode == "heat" self.ecobee["settings"]["hvacMode"] = "off" - assert "off" == self.thermostat.hvac_mode + assert self.thermostat.hvac_mode == "off" def test_hvac_modes(self): """Test operation list property.""" - assert ["auto", "heat", "cool", "off"] == self.thermostat.hvac_modes + assert ["heat_cool", "heat", "cool", "off"] == self.thermostat.hvac_modes def test_hvac_mode2(self): """Test operation mode property.""" - assert "auto" == self.thermostat.hvac_mode + assert self.thermostat.hvac_mode == "heat_cool" self.ecobee["settings"]["hvacMode"] = "heat" - assert "heat" == self.thermostat.hvac_mode + assert self.thermostat.hvac_mode == "heat" def test_device_state_attributes(self): """Test device state attributes property.""" @@ -222,7 +222,7 @@ class TestEcobee(unittest.TestCase): def test_set_hvac_mode(self): """Test operation mode setter.""" self.data.reset_mock() - self.thermostat.set_hvac_mode("auto") + self.thermostat.set_hvac_mode("heat_cool") self.data.ecobee.set_hvac_mode.assert_has_calls([mock.call(1, "auto")]) self.data.reset_mock() self.thermostat.set_hvac_mode("heat")