mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Set temperature precision for Ecobee climate entities to tenths (#48697)
This commit is contained in:
parent
f6a24e8d68
commit
523a71ac20
@ -32,6 +32,7 @@ from homeassistant.components.climate.const import (
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
|
PRECISION_TENTHS,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
)
|
)
|
||||||
@ -379,6 +380,11 @@ class Thermostat(ClimateEntity):
|
|||||||
"""Return the unit of measurement."""
|
"""Return the unit of measurement."""
|
||||||
return TEMP_FAHRENHEIT
|
return TEMP_FAHRENHEIT
|
||||||
|
|
||||||
|
@property
|
||||||
|
def precision(self) -> float:
|
||||||
|
"""Return the precision of the system."""
|
||||||
|
return PRECISION_TENTHS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self):
|
def current_temperature(self):
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
@ -388,14 +394,14 @@ class Thermostat(ClimateEntity):
|
|||||||
def target_temperature_low(self):
|
def target_temperature_low(self):
|
||||||
"""Return the lower bound temperature we try to reach."""
|
"""Return the lower bound temperature we try to reach."""
|
||||||
if self.hvac_mode == HVAC_MODE_HEAT_COOL:
|
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
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target_temperature_high(self):
|
def target_temperature_high(self):
|
||||||
"""Return the upper bound temperature we try to reach."""
|
"""Return the upper bound temperature we try to reach."""
|
||||||
if self.hvac_mode == HVAC_MODE_HEAT_COOL:
|
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
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -429,9 +435,9 @@ class Thermostat(ClimateEntity):
|
|||||||
if self.hvac_mode == HVAC_MODE_HEAT_COOL:
|
if self.hvac_mode == HVAC_MODE_HEAT_COOL:
|
||||||
return None
|
return None
|
||||||
if self.hvac_mode == HVAC_MODE_HEAT:
|
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:
|
if self.hvac_mode == HVAC_MODE_COOL:
|
||||||
return self.thermostat["runtime"]["desiredCool"] / 10.0
|
return round(self.thermostat["runtime"]["desiredCool"] / 10.0)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -83,14 +83,14 @@ async def test_target_temperature_low(ecobee_fixture, thermostat):
|
|||||||
"""Test target low temperature."""
|
"""Test target low temperature."""
|
||||||
assert thermostat.target_temperature_low == 40
|
assert thermostat.target_temperature_low == 40
|
||||||
ecobee_fixture["runtime"]["desiredHeat"] = 502
|
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):
|
async def test_target_temperature_high(ecobee_fixture, thermostat):
|
||||||
"""Test target high temperature."""
|
"""Test target high temperature."""
|
||||||
assert thermostat.target_temperature_high == 20
|
assert thermostat.target_temperature_high == 20
|
||||||
ecobee_fixture["runtime"]["desiredCool"] = 103
|
ecobee_fixture["runtime"]["desiredCool"] = 679
|
||||||
assert thermostat.target_temperature_high == 10.3
|
assert thermostat.target_temperature_high == 68
|
||||||
|
|
||||||
|
|
||||||
async def test_target_temperature(ecobee_fixture, thermostat):
|
async def test_target_temperature(ecobee_fixture, thermostat):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user