Ecobee to use HVAC mode heat-cool instead of auto (#34193)

This commit is contained in:
Paulus Schoutsen 2020-04-14 00:56:50 -07:00 committed by GitHub
parent c555ab1a84
commit a9908f0a94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 17 deletions

View file

@ -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)

View file

@ -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")