diff --git a/homeassistant/components/adax/climate.py b/homeassistant/components/adax/climate.py index 8703619ca925..cc15872dafa0 100644 --- a/homeassistant/components/adax/climate.py +++ b/homeassistant/components/adax/climate.py @@ -19,7 +19,7 @@ from homeassistant.const import ( CONF_TOKEN, CONF_UNIQUE_ID, PRECISION_WHOLE, - TEMP_CELSIUS, + UnitOfTemperature, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.aiohttp_client import async_get_clientsession @@ -69,7 +69,7 @@ class AdaxDevice(ClimateEntity): _attr_min_temp = 5 _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _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: """Initialize the heater.""" @@ -132,7 +132,7 @@ class LocalAdaxDevice(ClimateEntity): _attr_min_temp = 5 _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_target_temperature_step = PRECISION_WHOLE - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, adax_data_handler, unique_id): """Initialize the heater.""" diff --git a/homeassistant/components/advantage_air/climate.py b/homeassistant/components/advantage_air/climate.py index fdba46cde766..362701f3b9f3 100644 --- a/homeassistant/components/advantage_air/climate.py +++ b/homeassistant/components/advantage_air/climate.py @@ -14,7 +14,7 @@ from homeassistant.components.climate import ( HVACMode, ) 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.helpers.entity_platform import AddEntitiesCallback @@ -83,7 +83,7 @@ async def async_setup_entry( class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity): """AdvantageAir AC unit.""" - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS _attr_target_temperature_step = PRECISION_WHOLE _attr_max_temp = 32 _attr_min_temp = 16 @@ -149,7 +149,7 @@ class AdvantageAirAC(AdvantageAirAcEntity, ClimateEntity): class AdvantageAirZone(AdvantageAirZoneEntity, ClimateEntity): """AdvantageAir Zone control.""" - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS _attr_target_temperature_step = PRECISION_WHOLE _attr_max_temp = 32 _attr_min_temp = 16 diff --git a/homeassistant/components/airtouch4/climate.py b/homeassistant/components/airtouch4/climate.py index 598b6ecd6e3b..e7d73ec0f1c4 100644 --- a/homeassistant/components/airtouch4/climate.py +++ b/homeassistant/components/airtouch4/climate.py @@ -16,7 +16,7 @@ from homeassistant.components.climate import ( HVACMode, ) 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.helpers.entity import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -87,7 +87,7 @@ class AirtouchAC(CoordinatorEntity, ClimateEntity): _attr_supported_features = ( ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE ) - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, coordinator, ac_number, info): """Initialize the climate device.""" @@ -201,7 +201,7 @@ class AirtouchGroup(CoordinatorEntity, ClimateEntity): """Representation of an AirTouch 4 group.""" _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS _attr_hvac_modes = AT_GROUP_MODES def __init__(self, coordinator, group_number, info): diff --git a/homeassistant/components/ambiclimate/climate.py b/homeassistant/components/ambiclimate/climate.py index 5a5fea6c2306..2bb2b441430a 100644 --- a/homeassistant/components/ambiclimate/climate.py +++ b/homeassistant/components/ambiclimate/climate.py @@ -19,7 +19,7 @@ from homeassistant.const import ( ATTR_TEMPERATURE, CONF_CLIENT_ID, CONF_CLIENT_SECRET, - TEMP_CELSIUS, + UnitOfTemperature, ) from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.helpers import config_validation as cv @@ -150,7 +150,7 @@ async def async_setup_entry( class AmbiclimateEntity(ClimateEntity): """Representation of a Ambiclimate Thermostat device.""" - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS _attr_target_temperature_step = 1 _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF] diff --git a/homeassistant/components/baf/climate.py b/homeassistant/components/baf/climate.py index d4ed4ac43379..6798639e7a8b 100644 --- a/homeassistant/components/baf/climate.py +++ b/homeassistant/components/baf/climate.py @@ -10,7 +10,7 @@ from homeassistant.components.climate import ( HVACAction, HVACMode, ) -from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS +from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -36,7 +36,7 @@ class BAFAutoComfort(BAFEntity, ClimateEntity): """BAF climate auto comfort.""" _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS _attr_hvac_modes = [HVACMode.OFF, HVACMode.FAN_ONLY] @callback diff --git a/homeassistant/components/balboa/climate.py b/homeassistant/components/balboa/climate.py index 1cd93b4fddb7..c04f6367cfd7 100644 --- a/homeassistant/components/balboa/climate.py +++ b/homeassistant/components/balboa/climate.py @@ -19,8 +19,7 @@ from homeassistant.const import ( ATTR_TEMPERATURE, PRECISION_HALVES, PRECISION_WHOLE, - TEMP_CELSIUS, - TEMP_FAHRENHEIT, + UnitOfTemperature, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -82,10 +81,10 @@ class BalboaSpaClimate(BalboaEntity, ClimateEntity): self._attr_supported_features |= ClimateEntityFeature.FAN_MODE 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_temperature_unit = TEMP_FAHRENHEIT + self._attr_temperature_unit = UnitOfTemperature.FAHRENHEIT self._attr_precision = PRECISION_WHOLE 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 @property diff --git a/homeassistant/components/blebox/climate.py b/homeassistant/components/blebox/climate.py index 9b632c9aceb6..ba371b6d1f83 100644 --- a/homeassistant/components/blebox/climate.py +++ b/homeassistant/components/blebox/climate.py @@ -12,7 +12,7 @@ from homeassistant.components.climate import ( HVACMode, ) 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.helpers.entity_platform import AddEntitiesCallback @@ -41,7 +41,7 @@ class BleBoxClimateEntity(BleBoxEntity[blebox_uniapi.climate.Climate], ClimateEn _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE _attr_hvac_modes = [HVACMode.OFF, HVACMode.HEAT] - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS @property def hvac_mode(self): diff --git a/homeassistant/components/coolmaster/climate.py b/homeassistant/components/coolmaster/climate.py index d2b0685cdf09..933072aac9d7 100644 --- a/homeassistant/components/coolmaster/climate.py +++ b/homeassistant/components/coolmaster/climate.py @@ -8,7 +8,7 @@ from homeassistant.components.climate import ( HVACMode, ) 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.helpers.entity import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -100,9 +100,9 @@ class CoolmasterClimate(CoordinatorEntity, ClimateEntity): def temperature_unit(self) -> str: """Return the unit of measurement.""" if self._unit.temperature_unit == "celsius": - return TEMP_CELSIUS + return UnitOfTemperature.CELSIUS - return TEMP_FAHRENHEIT + return UnitOfTemperature.FAHRENHEIT @property def current_temperature(self): diff --git a/homeassistant/components/daikin/climate.py b/homeassistant/components/daikin/climate.py index bd4763d32548..bd0e846ea4d9 100644 --- a/homeassistant/components/daikin/climate.py +++ b/homeassistant/components/daikin/climate.py @@ -22,7 +22,12 @@ from homeassistant.components.climate import ( HVACMode, ) 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 import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -118,7 +123,7 @@ class DaikinClimate(ClimateEntity): _attr_name = None _attr_has_entity_name = True - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, api: DaikinApi) -> None: """Initialize the climate device.""" diff --git a/homeassistant/components/deconz/climate.py b/homeassistant/components/deconz/climate.py index c5b9571ed341..eb1d0d6b6725 100644 --- a/homeassistant/components/deconz/climate.py +++ b/homeassistant/components/deconz/climate.py @@ -28,7 +28,7 @@ from homeassistant.components.climate import ( HVACMode, ) 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.helpers.entity_platform import AddEntitiesCallback @@ -99,7 +99,7 @@ class DeconzThermostat(DeconzDevice[Thermostat], ClimateEntity): TYPE = DOMAIN - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, device: Thermostat, gateway: DeconzGateway) -> None: """Set up thermostat device.""" diff --git a/homeassistant/components/ecobee/climate.py b/homeassistant/components/ecobee/climate.py index 028979b2a850..b5512ce3c88a 100644 --- a/homeassistant/components/ecobee/climate.py +++ b/homeassistant/components/ecobee/climate.py @@ -26,7 +26,7 @@ from homeassistant.const import ( PRECISION_TENTHS, STATE_OFF, STATE_ON, - TEMP_FAHRENHEIT, + UnitOfTemperature, ) from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.helpers import entity_platform @@ -304,7 +304,7 @@ class Thermostat(ClimateEntity): """A thermostat class for Ecobee.""" _attr_precision = PRECISION_TENTHS - _attr_temperature_unit = TEMP_FAHRENHEIT + _attr_temperature_unit = UnitOfTemperature.FAHRENHEIT def __init__(self, data, thermostat_index, thermostat): """Initialize the thermostat.""" @@ -766,12 +766,12 @@ class Thermostat(ClimateEntity): cool_temp = TemperatureConverter.convert( service_data[ATTR_COOL_TEMP], self.hass.config.units.temperature_unit, - TEMP_FAHRENHEIT, + UnitOfTemperature.FAHRENHEIT, ) heat_temp = TemperatureConverter.convert( service_data[ATTR_HEAT_TEMP], self.hass.config.units.temperature_unit, - TEMP_FAHRENHEIT, + UnitOfTemperature.FAHRENHEIT, ) start_date = service_data.get(ATTR_START_DATE) start_time = service_data.get(ATTR_START_TIME) diff --git a/homeassistant/components/ephember/climate.py b/homeassistant/components/ephember/climate.py index 9c83a1c8a67b..3735b4d16c2e 100644 --- a/homeassistant/components/ephember/climate.py +++ b/homeassistant/components/ephember/climate.py @@ -29,7 +29,7 @@ from homeassistant.const import ( ATTR_TEMPERATURE, CONF_PASSWORD, CONF_USERNAME, - TEMP_CELSIUS, + UnitOfTemperature, ) from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -82,7 +82,7 @@ class EphEmberThermostat(ClimateEntity): """Representation of a EphEmber thermostat.""" _attr_hvac_modes = OPERATION_LIST - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, ember, zone): """Initialize the thermostat.""" diff --git a/homeassistant/components/eq3btsmart/climate.py b/homeassistant/components/eq3btsmart/climate.py index 027366c96ef4..1ac4531a3764 100644 --- a/homeassistant/components/eq3btsmart/climate.py +++ b/homeassistant/components/eq3btsmart/climate.py @@ -21,7 +21,7 @@ from homeassistant.const import ( CONF_DEVICES, CONF_MAC, PRECISION_HALVES, - TEMP_CELSIUS, + UnitOfTemperature, ) from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -107,7 +107,7 @@ class EQ3BTSmartThermostat(ClimateEntity): _attr_supported_features = ( ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE ) - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, mac: str, name: str) -> None: """Initialize the thermostat.""" diff --git a/homeassistant/components/escea/climate.py b/homeassistant/components/escea/climate.py index a764c019c500..df191afb859f 100644 --- a/homeassistant/components/escea/climate.py +++ b/homeassistant/components/escea/climate.py @@ -16,7 +16,7 @@ from homeassistant.components.climate import ( HVACMode, ) 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.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import DeviceInfo @@ -84,7 +84,7 @@ class ControllerEntity(ClimateEntity): ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE ) _attr_target_temperature_step = PRECISION_WHOLE - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, controller: Controller) -> None: """Initialise ControllerDevice.""" diff --git a/homeassistant/components/esphome/climate.py b/homeassistant/components/esphome/climate.py index 352068aaa577..058e557b1a84 100644 --- a/homeassistant/components/esphome/climate.py +++ b/homeassistant/components/esphome/climate.py @@ -49,7 +49,7 @@ from homeassistant.const import ( PRECISION_HALVES, PRECISION_TENTHS, PRECISION_WHOLE, - TEMP_CELSIUS, + UnitOfTemperature, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -136,7 +136,7 @@ _PRESETS: EsphomeEnumMapper[ClimatePreset, str] = EsphomeEnumMapper( class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEntity): """A climate implementation for ESPHome.""" - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS @property def precision(self) -> float: diff --git a/homeassistant/components/evohome/climate.py b/homeassistant/components/evohome/climate.py index 4594268623c8..a7b8b19ce473 100644 --- a/homeassistant/components/evohome/climate.py +++ b/homeassistant/components/evohome/climate.py @@ -14,7 +14,7 @@ from homeassistant.components.climate import ( ClimateEntityFeature, HVACMode, ) -from homeassistant.const import PRECISION_TENTHS, TEMP_CELSIUS +from homeassistant.const import PRECISION_TENTHS, UnitOfTemperature from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -126,7 +126,7 @@ async def async_setup_platform( class EvoClimateEntity(EvoDevice, ClimateEntity): """Base for an evohome Climate device.""" - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS @property def hvac_modes(self) -> list[str]: diff --git a/homeassistant/components/fibaro/climate.py b/homeassistant/components/fibaro/climate.py index 7731b2544c4f..8607d2c681a5 100644 --- a/homeassistant/components/fibaro/climate.py +++ b/homeassistant/components/fibaro/climate.py @@ -15,12 +15,7 @@ from homeassistant.components.climate import ( HVACMode, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ( - ATTR_TEMPERATURE, - TEMP_CELSIUS, - TEMP_FAHRENHEIT, - Platform, -) +from homeassistant.const import ATTR_TEMPERATURE, Platform, UnitOfTemperature from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -175,9 +170,9 @@ class FibaroThermostat(FibaroDevice, ClimateEntity): self._attr_supported_features |= ClimateEntityFeature.FAN_MODE if tempunit == "F": - self._attr_temperature_unit = TEMP_FAHRENHEIT + self._attr_temperature_unit = UnitOfTemperature.FAHRENHEIT else: - self._attr_temperature_unit = TEMP_CELSIUS + self._attr_temperature_unit = UnitOfTemperature.CELSIUS if self._fan_mode_device: fan_modes = ( diff --git a/homeassistant/components/flexit/climate.py b/homeassistant/components/flexit/climate.py index 27f2314c1f28..ac8f4b4da8c3 100644 --- a/homeassistant/components/flexit/climate.py +++ b/homeassistant/components/flexit/climate.py @@ -27,7 +27,7 @@ from homeassistant.const import ( CONF_NAME, CONF_SLAVE, DEVICE_DEFAULT_NAME, - TEMP_CELSIUS, + UnitOfTemperature, ) from homeassistant.core import HomeAssistant import homeassistant.helpers.config_validation as cv @@ -67,7 +67,7 @@ class Flexit(ClimateEntity): _attr_supported_features = ( ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE ) - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__( self, hub: ModbusHub, modbus_slave: int | None, name: str | None diff --git a/homeassistant/components/freedompro/climate.py b/homeassistant/components/freedompro/climate.py index 0b5f147c1415..0ec08f0fdd04 100644 --- a/homeassistant/components/freedompro/climate.py +++ b/homeassistant/components/freedompro/climate.py @@ -15,7 +15,7 @@ from homeassistant.components.climate import ( HVACMode, ) 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.helpers import aiohttp_client from homeassistant.helpers.entity import DeviceInfo @@ -61,7 +61,7 @@ class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], ClimateEntity): """Representation of an Freedompro climate.""" _attr_hvac_modes = SUPPORTED_HVAC_MODES - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS def __init__( self, diff --git a/homeassistant/components/fritzbox/climate.py b/homeassistant/components/fritzbox/climate.py index b1898c41cc7d..31cdac47ec2c 100644 --- a/homeassistant/components/fritzbox/climate.py +++ b/homeassistant/components/fritzbox/climate.py @@ -16,7 +16,7 @@ from homeassistant.const import ( ATTR_BATTERY_LEVEL, ATTR_TEMPERATURE, PRECISION_HALVES, - TEMP_CELSIUS, + UnitOfTemperature, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -70,7 +70,7 @@ class FritzboxThermostat(FritzBoxDeviceEntity, ClimateEntity): _attr_supported_features = ( ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE ) - _attr_temperature_unit = TEMP_CELSIUS + _attr_temperature_unit = UnitOfTemperature.CELSIUS @property def current_temperature(self) -> float: