Use unit_conversion in components (#79204)
* Use unit_conversion in components * Two more
This commit is contained in:
parent
f76eeaeea1
commit
24c26dc032
19 changed files with 84 additions and 63 deletions
|
@ -17,7 +17,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.util.temperature import convert as convert_temperature
|
||||
from homeassistant.util.unit_conversion import TemperatureConverter
|
||||
|
||||
from .const import DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP, DOMAIN, SMARTTUB_CONTROLLER
|
||||
from .entity import SmartTubEntity
|
||||
|
@ -87,13 +87,17 @@ class SmartTubThermostat(SmartTubEntity, ClimateEntity):
|
|||
def min_temp(self):
|
||||
"""Return the minimum temperature."""
|
||||
min_temp = DEFAULT_MIN_TEMP
|
||||
return convert_temperature(min_temp, TEMP_CELSIUS, self.temperature_unit)
|
||||
return TemperatureConverter.convert(
|
||||
min_temp, TEMP_CELSIUS, self.temperature_unit
|
||||
)
|
||||
|
||||
@property
|
||||
def max_temp(self):
|
||||
"""Return the maximum temperature."""
|
||||
max_temp = DEFAULT_MAX_TEMP
|
||||
return convert_temperature(max_temp, TEMP_CELSIUS, self.temperature_unit)
|
||||
return TemperatureConverter.convert(
|
||||
max_temp, TEMP_CELSIUS, self.temperature_unit
|
||||
)
|
||||
|
||||
@property
|
||||
def preset_mode(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue