Use UnitOfTemperature in climate entities [a-f] (#83125)

This commit is contained in:
epenet 2022-12-04 10:53:56 +01:00 committed by GitHub
parent aace084931
commit 44d3f2192c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 53 additions and 54 deletions

View File

@ -19,7 +19,7 @@ from homeassistant.const import (
CONF_TOKEN, CONF_TOKEN,
CONF_UNIQUE_ID, CONF_UNIQUE_ID,
PRECISION_WHOLE, PRECISION_WHOLE,
TEMP_CELSIUS, UnitOfTemperature,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.aiohttp_client import async_get_clientsession
@ -69,7 +69,7 @@ class AdaxDevice(ClimateEntity):
_attr_min_temp = 5 _attr_min_temp = 5
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
_attr_target_temperature_step = PRECISION_WHOLE _attr_target_temperature_step = PRECISION_WHOLE
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
def __init__(self, heater_data: dict[str, Any], adax_data_handler: Adax) -> None: def __init__(self, heater_data: dict[str, Any], adax_data_handler: Adax) -> None:
"""Initialize the heater.""" """Initialize the heater."""
@ -132,7 +132,7 @@ class LocalAdaxDevice(ClimateEntity):
_attr_min_temp = 5 _attr_min_temp = 5
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
_attr_target_temperature_step = PRECISION_WHOLE _attr_target_temperature_step = PRECISION_WHOLE
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
def __init__(self, adax_data_handler, unique_id): def __init__(self, adax_data_handler, unique_id):
"""Initialize the heater.""" """Initialize the heater."""

View File

@ -14,7 +14,7 @@ from homeassistant.components.climate import (
HVACMode, HVACMode,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_WHOLE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, PRECISION_WHOLE, UnitOfTemperature
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -83,7 +83,7 @@ async def async_setup_entry(
class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity): class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity):
"""AdvantageAir AC unit.""" """AdvantageAir AC unit."""
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_target_temperature_step = PRECISION_WHOLE _attr_target_temperature_step = PRECISION_WHOLE
_attr_max_temp = 32 _attr_max_temp = 32
_attr_min_temp = 16 _attr_min_temp = 16
@ -149,7 +149,7 @@ class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity):
class AdvantageAirZone(AdvantageAirZoneEntity, ClimateEntity): class AdvantageAirZone(AdvantageAirZoneEntity, ClimateEntity):
"""AdvantageAir Zone control.""" """AdvantageAir Zone control."""
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_target_temperature_step = PRECISION_WHOLE _attr_target_temperature_step = PRECISION_WHOLE
_attr_max_temp = 32 _attr_max_temp = 32
_attr_min_temp = 16 _attr_min_temp = 16

View File

@ -16,7 +16,7 @@ from homeassistant.components.climate import (
HVACMode, HVACMode,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -87,7 +87,7 @@ class AirtouchAC(CoordinatorEntity, ClimateEntity):
_attr_supported_features = ( _attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
) )
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
def __init__(self, coordinator, ac_number, info): def __init__(self, coordinator, ac_number, info):
"""Initialize the climate device.""" """Initialize the climate device."""
@ -201,7 +201,7 @@ class AirtouchGroup(CoordinatorEntity, ClimateEntity):
"""Representation of an AirTouch 4 group.""" """Representation of an AirTouch 4 group."""
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_hvac_modes = AT_GROUP_MODES _attr_hvac_modes = AT_GROUP_MODES
def __init__(self, coordinator, group_number, info): def __init__(self, coordinator, group_number, info):

View File

@ -19,7 +19,7 @@ from homeassistant.const import (
ATTR_TEMPERATURE, ATTR_TEMPERATURE,
CONF_CLIENT_ID, CONF_CLIENT_ID,
CONF_CLIENT_SECRET, CONF_CLIENT_SECRET,
TEMP_CELSIUS, UnitOfTemperature,
) )
from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
@ -150,7 +150,7 @@ async def async_setup_entry(
class AmbiclimateEntity(ClimateEntity): class AmbiclimateEntity(ClimateEntity):
"""Representation of a Ambiclimate Thermostat device.""" """Representation of a Ambiclimate Thermostat device."""
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_target_temperature_step = 1 _attr_target_temperature_step = 1
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
_attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF] _attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]

View File

@ -10,7 +10,7 @@ from homeassistant.components.climate import (
HVACAction, HVACAction,
HVACMode, HVACMode,
) )
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -36,7 +36,7 @@ class BAFAutoComfort(BAFEntity, ClimateEntity):
"""BAF climate auto comfort.""" """BAF climate auto comfort."""
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_hvac_modes = [HVACMode.OFF, HVACMode.FAN_ONLY] _attr_hvac_modes = [HVACMode.OFF, HVACMode.FAN_ONLY]
@callback @callback

View File

@ -19,8 +19,7 @@ from homeassistant.const import (
ATTR_TEMPERATURE, ATTR_TEMPERATURE,
PRECISION_HALVES, PRECISION_HALVES,
PRECISION_WHOLE, PRECISION_WHOLE,
TEMP_CELSIUS, UnitOfTemperature,
TEMP_FAHRENHEIT,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -82,10 +81,10 @@ class BalboaSpaClimate(BalboaEntity, ClimateEntity):
self._attr_supported_features |= ClimateEntityFeature.FAN_MODE self._attr_supported_features |= ClimateEntityFeature.FAN_MODE
self._attr_min_temp = self._client.tmin[self._client.TEMPRANGE_LOW][scale] self._attr_min_temp = self._client.tmin[self._client.TEMPRANGE_LOW][scale]
self._attr_max_temp = self._client.tmax[self._client.TEMPRANGE_HIGH][scale] self._attr_max_temp = self._client.tmax[self._client.TEMPRANGE_HIGH][scale]
self._attr_temperature_unit = TEMP_FAHRENHEIT self._attr_temperature_unit = UnitOfTemperature.FAHRENHEIT
self._attr_precision = PRECISION_WHOLE self._attr_precision = PRECISION_WHOLE
if self._client.get_tempscale() == self._client.TSCALE_C: if self._client.get_tempscale() == self._client.TSCALE_C:
self._attr_temperature_unit = TEMP_CELSIUS self._attr_temperature_unit = UnitOfTemperature.CELSIUS
self._attr_precision = PRECISION_HALVES self._attr_precision = PRECISION_HALVES
@property @property

View File

@ -12,7 +12,7 @@ from homeassistant.components.climate import (
HVACMode, HVACMode,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -41,7 +41,7 @@ class BleBoxClimateEntity(BleBoxEntity[blebox_uniapi.climate.Climate], ClimateEn
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
_attr_hvac_modes = [HVACMode.OFF, HVACMode.HEAT] _attr_hvac_modes = [HVACMode.OFF, HVACMode.HEAT]
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
@property @property
def hvac_mode(self): def hvac_mode(self):

View File

@ -8,7 +8,7 @@ from homeassistant.components.climate import (
HVACMode, HVACMode,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -100,9 +100,9 @@ class CoolmasterClimate(CoordinatorEntity, ClimateEntity):
def temperature_unit(self) -> str: def temperature_unit(self) -> str:
"""Return the unit of measurement.""" """Return the unit of measurement."""
if self._unit.temperature_unit == "celsius": if self._unit.temperature_unit == "celsius":
return TEMP_CELSIUS return UnitOfTemperature.CELSIUS
return TEMP_FAHRENHEIT return UnitOfTemperature.FAHRENHEIT
@property @property
def current_temperature(self): def current_temperature(self):

View File

@ -22,7 +22,12 @@ from homeassistant.components.climate import (
HVACMode, HVACMode,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, CONF_HOST, CONF_NAME, TEMP_CELSIUS from homeassistant.const import (
ATTR_TEMPERATURE,
CONF_HOST,
CONF_NAME,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -118,7 +123,7 @@ class DaikinClimate(ClimateEntity):
_attr_name = None _attr_name = None
_attr_has_entity_name = True _attr_has_entity_name = True
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
def __init__(self, api: DaikinApi) -> None: def __init__(self, api: DaikinApi) -> None:
"""Initialize the climate device.""" """Initialize the climate device."""

View File

@ -28,7 +28,7 @@ from homeassistant.components.climate import (
HVACMode, HVACMode,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -99,7 +99,7 @@ class DeconzThermostat(DeconzDevice[Thermostat], ClimateEntity):
TYPE = DOMAIN TYPE = DOMAIN
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
def __init__(self, device: Thermostat, gateway: DeconzGateway) -> None: def __init__(self, device: Thermostat, gateway: DeconzGateway) -> None:
"""Set up thermostat device.""" """Set up thermostat device."""

View File

@ -26,7 +26,7 @@ from homeassistant.const import (
PRECISION_TENTHS, PRECISION_TENTHS,
STATE_OFF, STATE_OFF,
STATE_ON, STATE_ON,
TEMP_FAHRENHEIT, UnitOfTemperature,
) )
from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.helpers import entity_platform from homeassistant.helpers import entity_platform
@ -304,7 +304,7 @@ class Thermostat(ClimateEntity):
"""A thermostat class for Ecobee.""" """A thermostat class for Ecobee."""
_attr_precision = PRECISION_TENTHS _attr_precision = PRECISION_TENTHS
_attr_temperature_unit = TEMP_FAHRENHEIT _attr_temperature_unit = UnitOfTemperature.FAHRENHEIT
def __init__(self, data, thermostat_index, thermostat): def __init__(self, data, thermostat_index, thermostat):
"""Initialize the thermostat.""" """Initialize the thermostat."""
@ -766,12 +766,12 @@ class Thermostat(ClimateEntity):
cool_temp = TemperatureConverter.convert( cool_temp = TemperatureConverter.convert(
service_data[ATTR_COOL_TEMP], service_data[ATTR_COOL_TEMP],
self.hass.config.units.temperature_unit, self.hass.config.units.temperature_unit,
TEMP_FAHRENHEIT, UnitOfTemperature.FAHRENHEIT,
) )
heat_temp = TemperatureConverter.convert( heat_temp = TemperatureConverter.convert(
service_data[ATTR_HEAT_TEMP], service_data[ATTR_HEAT_TEMP],
self.hass.config.units.temperature_unit, self.hass.config.units.temperature_unit,
TEMP_FAHRENHEIT, UnitOfTemperature.FAHRENHEIT,
) )
start_date = service_data.get(ATTR_START_DATE) start_date = service_data.get(ATTR_START_DATE)
start_time = service_data.get(ATTR_START_TIME) start_time = service_data.get(ATTR_START_TIME)

View File

@ -29,7 +29,7 @@ from homeassistant.const import (
ATTR_TEMPERATURE, ATTR_TEMPERATURE,
CONF_PASSWORD, CONF_PASSWORD,
CONF_USERNAME, CONF_USERNAME,
TEMP_CELSIUS, UnitOfTemperature,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -82,7 +82,7 @@ class EphEmberThermostat(ClimateEntity):
"""Representation of a EphEmber thermostat.""" """Representation of a EphEmber thermostat."""
_attr_hvac_modes = OPERATION_LIST _attr_hvac_modes = OPERATION_LIST
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
def __init__(self, ember, zone): def __init__(self, ember, zone):
"""Initialize the thermostat.""" """Initialize the thermostat."""

View File

@ -21,7 +21,7 @@ from homeassistant.const import (
CONF_DEVICES, CONF_DEVICES,
CONF_MAC, CONF_MAC,
PRECISION_HALVES, PRECISION_HALVES,
TEMP_CELSIUS, UnitOfTemperature,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -107,7 +107,7 @@ class EQ3BTSmartThermostat(ClimateEntity):
_attr_supported_features = ( _attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
) )
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
def __init__(self, mac: str, name: str) -> None: def __init__(self, mac: str, name: str) -> None:
"""Initialize the thermostat.""" """Initialize the thermostat."""

View File

@ -16,7 +16,7 @@ from homeassistant.components.climate import (
HVACMode, HVACMode,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_WHOLE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, PRECISION_WHOLE, UnitOfTemperature
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
@ -84,7 +84,7 @@ class ControllerEntity(ClimateEntity):
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
) )
_attr_target_temperature_step = PRECISION_WHOLE _attr_target_temperature_step = PRECISION_WHOLE
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
def __init__(self, controller: Controller) -> None: def __init__(self, controller: Controller) -> None:
"""Initialise ControllerDevice.""" """Initialise ControllerDevice."""

View File

@ -49,7 +49,7 @@ from homeassistant.const import (
PRECISION_HALVES, PRECISION_HALVES,
PRECISION_TENTHS, PRECISION_TENTHS,
PRECISION_WHOLE, PRECISION_WHOLE,
TEMP_CELSIUS, UnitOfTemperature,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -136,7 +136,7 @@ _PRESETS: EsphomeEnumMapper[ClimatePreset, str] = EsphomeEnumMapper(
class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEntity): class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEntity):
"""A climate implementation for ESPHome.""" """A climate implementation for ESPHome."""
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
@property @property
def precision(self) -> float: def precision(self) -> float:

View File

@ -14,7 +14,7 @@ from homeassistant.components.climate import (
ClimateEntityFeature, ClimateEntityFeature,
HVACMode, HVACMode,
) )
from homeassistant.const import PRECISION_TENTHS, TEMP_CELSIUS from homeassistant.const import PRECISION_TENTHS, UnitOfTemperature
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -126,7 +126,7 @@ async def async_setup_platform(
class EvoClimateEntity(EvoDevice, ClimateEntity): class EvoClimateEntity(EvoDevice, ClimateEntity):
"""Base for an evohome Climate device.""" """Base for an evohome Climate device."""
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
@property @property
def hvac_modes(self) -> list[str]: def hvac_modes(self) -> list[str]:

View File

@ -15,12 +15,7 @@ from homeassistant.components.climate import (
HVACMode, HVACMode,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import ATTR_TEMPERATURE, Platform, UnitOfTemperature
ATTR_TEMPERATURE,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
Platform,
)
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -175,9 +170,9 @@ class FibaroThermostat(FibaroDevice, ClimateEntity):
self._attr_supported_features |= ClimateEntityFeature.FAN_MODE self._attr_supported_features |= ClimateEntityFeature.FAN_MODE
if tempunit == "F": if tempunit == "F":
self._attr_temperature_unit = TEMP_FAHRENHEIT self._attr_temperature_unit = UnitOfTemperature.FAHRENHEIT
else: else:
self._attr_temperature_unit = TEMP_CELSIUS self._attr_temperature_unit = UnitOfTemperature.CELSIUS
if self._fan_mode_device: if self._fan_mode_device:
fan_modes = ( fan_modes = (

View File

@ -27,7 +27,7 @@ from homeassistant.const import (
CONF_NAME, CONF_NAME,
CONF_SLAVE, CONF_SLAVE,
DEVICE_DEFAULT_NAME, DEVICE_DEFAULT_NAME,
TEMP_CELSIUS, UnitOfTemperature,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -67,7 +67,7 @@ class Flexit(ClimateEntity):
_attr_supported_features = ( _attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
) )
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
def __init__( def __init__(
self, hub: ModbusHub, modbus_slave: int | None, name: str | None self, hub: ModbusHub, modbus_slave: int | None, name: str | None

View File

@ -15,7 +15,7 @@ from homeassistant.components.climate import (
HVACMode, HVACMode,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, CONF_API_KEY, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, CONF_API_KEY, UnitOfTemperature
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import aiohttp_client from homeassistant.helpers import aiohttp_client
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
@ -61,7 +61,7 @@ class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], ClimateEntity):
"""Representation of an Freedompro climate.""" """Representation of an Freedompro climate."""
_attr_hvac_modes = SUPPORTED_HVAC_MODES _attr_hvac_modes = SUPPORTED_HVAC_MODES
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
def __init__( def __init__(
self, self,

View File

@ -16,7 +16,7 @@ from homeassistant.const import (
ATTR_BATTERY_LEVEL, ATTR_BATTERY_LEVEL,
ATTR_TEMPERATURE, ATTR_TEMPERATURE,
PRECISION_HALVES, PRECISION_HALVES,
TEMP_CELSIUS, UnitOfTemperature,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -70,7 +70,7 @@ class FritzboxThermostat(FritzBoxDeviceEntity, ClimateEntity):
_attr_supported_features = ( _attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
) )
_attr_temperature_unit = TEMP_CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
@property @property
def current_temperature(self) -> float: def current_temperature(self) -> float: