diff --git a/homeassistant/components/ecobee/climate.py b/homeassistant/components/ecobee/climate.py index dd29918ec18..6de23f09c60 100644 --- a/homeassistant/components/ecobee/climate.py +++ b/homeassistant/components/ecobee/climate.py @@ -32,6 +32,7 @@ from homeassistant.components.climate.const import ( from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_TEMPERATURE, + PRECISION_TENTHS, STATE_ON, TEMP_FAHRENHEIT, ) @@ -379,6 +380,11 @@ class Thermostat(ClimateEntity): """Return the unit of measurement.""" return TEMP_FAHRENHEIT + @property + def precision(self) -> float: + """Return the precision of the system.""" + return PRECISION_TENTHS + @property def current_temperature(self): """Return the current temperature.""" @@ -388,14 +394,14 @@ class Thermostat(ClimateEntity): def target_temperature_low(self): """Return the lower bound temperature we try to reach.""" if self.hvac_mode == HVAC_MODE_HEAT_COOL: - return self.thermostat["runtime"]["desiredHeat"] / 10.0 + return round(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_HEAT_COOL: - return self.thermostat["runtime"]["desiredCool"] / 10.0 + return round(self.thermostat["runtime"]["desiredCool"] / 10.0) return None @property @@ -429,9 +435,9 @@ class Thermostat(ClimateEntity): if self.hvac_mode == HVAC_MODE_HEAT_COOL: return None if self.hvac_mode == HVAC_MODE_HEAT: - return self.thermostat["runtime"]["desiredHeat"] / 10.0 + return round(self.thermostat["runtime"]["desiredHeat"] / 10.0) if self.hvac_mode == HVAC_MODE_COOL: - return self.thermostat["runtime"]["desiredCool"] / 10.0 + return round(self.thermostat["runtime"]["desiredCool"] / 10.0) return None @property diff --git a/tests/components/ecobee/test_climate.py b/tests/components/ecobee/test_climate.py index 86f9926b756..da6017a71a1 100644 --- a/tests/components/ecobee/test_climate.py +++ b/tests/components/ecobee/test_climate.py @@ -83,14 +83,14 @@ async def test_target_temperature_low(ecobee_fixture, thermostat): """Test target low temperature.""" assert thermostat.target_temperature_low == 40 ecobee_fixture["runtime"]["desiredHeat"] = 502 - assert thermostat.target_temperature_low == 50.2 + assert thermostat.target_temperature_low == 50 async def test_target_temperature_high(ecobee_fixture, thermostat): """Test target high temperature.""" assert thermostat.target_temperature_high == 20 - ecobee_fixture["runtime"]["desiredCool"] = 103 - assert thermostat.target_temperature_high == 10.3 + ecobee_fixture["runtime"]["desiredCool"] = 679 + assert thermostat.target_temperature_high == 68 async def test_target_temperature(ecobee_fixture, thermostat):