From c19ee3b599754b932571d674eae571dbf93908c6 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Wed, 7 Oct 2026 19:48:11 +0100 Subject: [PATCH] Migrate climate integrations to native temperature properties (part 6) (#184740) --- homeassistant/components/oem/climate.py | 6 +-- .../components/opentherm_gw/climate.py | 12 +++--- .../components/ouman_eh_800/climate.py | 6 +-- .../components/palazzetti/climate.py | 6 +-- homeassistant/components/plugwise/climate.py | 10 ++--- homeassistant/components/proliphix/climate.py | 6 +-- homeassistant/components/qbus/climate.py | 13 ++++--- .../components/radiotherm/climate.py | 18 ++++----- .../components/samsung_infrared/climate.py | 10 ++--- homeassistant/components/saunum/climate.py | 6 +-- homeassistant/components/schluter/climate.py | 6 +-- .../components/screenlogic/climate.py | 8 ++-- homeassistant/components/sensibo/climate.py | 14 +++---- homeassistant/components/senz/climate.py | 6 +-- homeassistant/components/shelly/climate.py | 32 ++++++++-------- .../components/smartthings/climate.py | 38 +++++++++---------- homeassistant/components/smarttub/climate.py | 6 +-- .../components/stiebel_eltron/climate.py | 6 +-- homeassistant/components/switchbee/climate.py | 10 +++-- homeassistant/components/switchbot/climate.py | 6 +-- 20 files changed, 115 insertions(+), 110 deletions(-) diff --git a/homeassistant/components/oem/climate.py b/homeassistant/components/oem/climate.py index d475a4b70c11..9e2dc5fdaba6 100644 --- a/homeassistant/components/oem/climate.py +++ b/homeassistant/components/oem/climate.py @@ -70,7 +70,7 @@ class ThermostatDevice(ClimateEntity): | ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON ) - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, thermostat, name): """Initialize the device.""" @@ -122,7 +122,7 @@ class ThermostatDevice(ClimateEntity): def update(self) -> None: """Update local state.""" - self._attr_target_temperature = self.thermostat.setpoint - self._attr_current_temperature = self.thermostat.temperature + self._attr_native_target_temperature = self.thermostat.setpoint + self._attr_native_current_temperature = self.thermostat.temperature self._state = self.thermostat.state self._mode = self.thermostat.mode diff --git a/homeassistant/components/opentherm_gw/climate.py b/homeassistant/components/opentherm_gw/climate.py index cdb52f6dfb8d..3046f0eb6a23 100644 --- a/homeassistant/components/opentherm_gw/climate.py +++ b/homeassistant/components/opentherm_gw/climate.py @@ -74,7 +74,7 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity): _attr_supported_features = ( ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE ) - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_hvac_modes = [HVACMode.HEAT] _attr_name = None _attr_preset_modes = [] @@ -139,9 +139,9 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity): else: self._attr_hvac_action = HVACAction.IDLE - self._attr_current_temperature = status[OpenThermDataSource.THERMOSTAT].get( - gw_vars.DATA_ROOM_TEMP - ) + self._attr_native_current_temperature = status[ + OpenThermDataSource.THERMOSTAT + ].get(gw_vars.DATA_ROOM_TEMP) temp_upd = status[OpenThermDataSource.THERMOSTAT].get( gw_vars.DATA_ROOM_SETPOINT ) @@ -176,7 +176,7 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity): @property @override - def target_temperature(self) -> float | None: + def native_target_temperature(self) -> float | None: """Return the temperature we try to reach.""" return self._new_target_temperature or self._target_temperature @@ -206,7 +206,7 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity): """Set new target temperature.""" if ATTR_TEMPERATURE in kwargs: temp = float(kwargs[ATTR_TEMPERATURE]) - if temp == self.target_temperature: + if temp == self.native_target_temperature: return self._new_target_temperature = await self._gateway.set_room_setpoint(temp) self.async_write_ha_state() diff --git a/homeassistant/components/ouman_eh_800/climate.py b/homeassistant/components/ouman_eh_800/climate.py index 5931354c1f49..a39c2e981667 100644 --- a/homeassistant/components/ouman_eh_800/climate.py +++ b/homeassistant/components/ouman_eh_800/climate.py @@ -103,7 +103,7 @@ class OumanEh800ClimateEntity(OumanEh800Entity, ClimateEntity): entity_description: OumanEh800ClimateEntityDescription _attr_name = None - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_target_temperature_step = 0.1 _attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF] _attr_preset_modes = list(_PRESET_TO_OPERATION_MODE) @@ -162,7 +162,7 @@ class OumanEh800ClimateEntity(OumanEh800Entity, ClimateEntity): @property @override - def current_temperature(self) -> float: + def native_current_temperature(self) -> float: """Return the current room temperature.""" value = self.coordinator.data[ self.entity_description.current_temperature_endpoint @@ -172,7 +172,7 @@ class OumanEh800ClimateEntity(OumanEh800Entity, ClimateEntity): @property @override - def target_temperature(self) -> float: + def native_target_temperature(self) -> float: """Return the user-set room temperature setpoint.""" value = self.coordinator.data[ self.entity_description.target_temperature_endpoint diff --git a/homeassistant/components/palazzetti/climate.py b/homeassistant/components/palazzetti/climate.py index 61eb9dfe8156..dbd20cf4b5ad 100644 --- a/homeassistant/components/palazzetti/climate.py +++ b/homeassistant/components/palazzetti/climate.py @@ -36,7 +36,7 @@ class PalazzettiClimateEntity(PalazzettiEntity, ClimateEntity): _attr_name = None _attr_translation_key = DOMAIN _attr_target_temperature_step = 1.0 - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_supported_features = ( ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE @@ -94,13 +94,13 @@ class PalazzettiClimateEntity(PalazzettiEntity, ClimateEntity): @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return current temperature.""" return self.coordinator.client.room_temperature @property @override - def target_temperature(self) -> int | None: + def native_target_temperature(self) -> int | None: """Return the temperature.""" return self.coordinator.client.target_temperature diff --git a/homeassistant/components/plugwise/climate.py b/homeassistant/components/plugwise/climate.py index 8492c8db3cf5..4db4293011c9 100644 --- a/homeassistant/components/plugwise/climate.py +++ b/homeassistant/components/plugwise/climate.py @@ -93,7 +93,7 @@ class PlugwiseClimateEntity(PlugwiseEntity, ClimateEntity, RestoreEntity): """Representation of a Plugwise thermostat.""" _attr_name = None - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_translation_key = DOMAIN def __init__( @@ -163,13 +163,13 @@ class PlugwiseClimateEntity(PlugwiseEntity, ClimateEntity, RestoreEntity): @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return the current temperature.""" return self.device["sensors"].get("temperature") @property @override - def target_temperature(self) -> float: + def native_target_temperature(self) -> float: """Return the temperature we try to reach. Connected to the HVACMode combination of AUTO-HEAT. @@ -179,7 +179,7 @@ class PlugwiseClimateEntity(PlugwiseEntity, ClimateEntity, RestoreEntity): @property @override - def target_temperature_high(self) -> float: + def native_target_temperature_high(self) -> float: """Return the temperature we try to reach in case of cooling. Connected to the HVACMode combination of AUTO-HEAT_COOL. @@ -188,7 +188,7 @@ class PlugwiseClimateEntity(PlugwiseEntity, ClimateEntity, RestoreEntity): @property @override - def target_temperature_low(self) -> float: + def native_target_temperature_low(self) -> float: """Return the heating temperature we try to reach in case of heating. Connected to the HVACMode combination AUTO-HEAT_COOL. diff --git a/homeassistant/components/proliphix/climate.py b/homeassistant/components/proliphix/climate.py index fc859f1c6630..a489360aac78 100644 --- a/homeassistant/components/proliphix/climate.py +++ b/homeassistant/components/proliphix/climate.py @@ -58,7 +58,7 @@ class ProliphixThermostat(ClimateEntity): _attr_precision = PRECISION_TENTHS _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE - _attr_temperature_unit = UnitOfTemperature.FAHRENHEIT + _attr_native_temperature_unit = UnitOfTemperature.FAHRENHEIT def __init__(self, pdp: proliphix.PDP) -> None: """Initialize the thermostat.""" @@ -78,13 +78,13 @@ class ProliphixThermostat(ClimateEntity): @property @override - def current_temperature(self) -> float: + def native_current_temperature(self) -> float: """Return the current temperature.""" return self._pdp.cur_temp @property @override - def target_temperature(self) -> float: + def native_target_temperature(self) -> float: """Return the temperature we try to reach.""" return self._pdp.setback diff --git a/homeassistant/components/qbus/climate.py b/homeassistant/components/qbus/climate.py index 36e1ced54093..6f3aedf61e14 100644 --- a/homeassistant/components/qbus/climate.py +++ b/homeassistant/components/qbus/climate.py @@ -64,7 +64,7 @@ class QbusClimate(QbusEntity, ClimateEntity): _attr_supported_features = ( ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TARGET_TEMPERATURE ) - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, mqtt_output: QbusMqttOutput) -> None: """Initialize climate entity.""" @@ -139,10 +139,10 @@ class QbusClimate(QbusEntity, ClimateEntity): self._attr_preset_mode = preset_mode if current_temperature := state.read_current_temperature(): - self._attr_current_temperature = current_temperature + self._attr_native_current_temperature = current_temperature if target_temperature := state.read_set_temperature(): - self._attr_target_temperature = target_temperature + self._attr_native_target_temperature = target_temperature self._set_hvac_action() @@ -155,13 +155,16 @@ class QbusClimate(QbusEntity, ClimateEntity): await self._request_state_debouncer.async_call() def _set_hvac_action(self) -> None: - if self.target_temperature is None or self.current_temperature is None: + if ( + self.native_target_temperature is None + or self.native_current_temperature is None + ): self._attr_hvac_action = HVACAction.IDLE return self._attr_hvac_action = ( HVACAction.HEATING - if self.target_temperature > self.current_temperature + if self.native_target_temperature > self.native_current_temperature else HVACAction.IDLE ) diff --git a/homeassistant/components/radiotherm/climate.py b/homeassistant/components/radiotherm/climate.py index 62c0aef53ed1..a65db8461223 100644 --- a/homeassistant/components/radiotherm/climate.py +++ b/homeassistant/components/radiotherm/climate.py @@ -108,7 +108,7 @@ class RadioThermostat(RadioThermostatEntity, ClimateEntity): """Representation of a Radio Thermostat.""" _attr_hvac_modes = OPERATION_LIST - _attr_temperature_unit = UnitOfTemperature.FAHRENHEIT + _attr_native_temperature_unit = UnitOfTemperature.FAHRENHEIT _attr_precision = PRECISION_HALVES _attr_name = None @@ -152,7 +152,7 @@ class RadioThermostat(RadioThermostatEntity, ClimateEntity): self._attr_current_humidity = self.data.humidity self._attr_preset_mode = CODE_TO_PRESET_MODE[data["program_mode"]] # Map thermostat values into various STATE_ flags. - self._attr_current_temperature = data["temp"] + self._attr_native_current_temperature = data["temp"] self._attr_fan_mode = CODE_TO_FAN_MODE[data["fmode"]] self._attr_extra_state_attributes = { ATTR_FAN_ACTION: CODE_TO_FAN_STATE[data["fstate"]] @@ -163,17 +163,17 @@ class RadioThermostat(RadioThermostatEntity, ClimateEntity): else: self._attr_hvac_action = CODE_TO_TEMP_STATE[data["tstate"]] if self.hvac_mode == HVACMode.COOL: - self._attr_target_temperature = data["t_cool"] + self._attr_native_target_temperature = data["t_cool"] elif self.hvac_mode == HVACMode.HEAT: - self._attr_target_temperature = data["t_heat"] + self._attr_native_target_temperature = data["t_heat"] elif self.hvac_mode == HVACMode.AUTO: # This doesn't really work - tstate is only set if the HVAC is # active. If it's idle, we don't know what to do with the target # temperature. if self.hvac_action == HVACAction.COOLING: - self._attr_target_temperature = data["t_cool"] + self._attr_native_target_temperature = data["t_cool"] elif self.hvac_action == HVACAction.HEATING: - self._attr_target_temperature = data["t_heat"] + self._attr_native_target_temperature = data["t_heat"] @override async def async_set_temperature(self, **kwargs: Any) -> None: @@ -181,7 +181,7 @@ class RadioThermostat(RadioThermostatEntity, ClimateEntity): if (temperature := kwargs.get(ATTR_TEMPERATURE)) is None: return await self.hass.async_add_executor_job(self._set_temperature, temperature) - self._attr_target_temperature = temperature + self._attr_native_target_temperature = temperature self.async_write_ha_state() await self.coordinator.async_request_refresh() @@ -212,9 +212,9 @@ class RadioThermostat(RadioThermostatEntity, ClimateEntity): self.device.tmode = TEMP_MODE_TO_CODE[hvac_mode] # Setting t_cool or t_heat automatically changes tmode. elif hvac_mode == HVACMode.COOL: - self.device.t_cool = self.target_temperature + self.device.t_cool = self.native_target_temperature elif hvac_mode == HVACMode.HEAT: - self.device.t_heat = self.target_temperature + self.device.t_heat = self.native_target_temperature @override async def async_set_preset_mode(self, preset_mode: str) -> None: diff --git a/homeassistant/components/samsung_infrared/climate.py b/homeassistant/components/samsung_infrared/climate.py index a973438d376d..b5984064521d 100644 --- a/homeassistant/components/samsung_infrared/climate.py +++ b/homeassistant/components/samsung_infrared/climate.py @@ -105,10 +105,10 @@ class SamsungIrClimate( _attr_name = None _attr_assumed_state = True - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_fan_modes = [FAN_AUTO, FAN_LOW, FAN_MEDIUM, FAN_HIGH] _attr_hvac_mode = HVACMode.OFF - _attr_target_temperature = 24.0 + _attr_native_target_temperature = 24.0 _attr_min_temp = 16.0 _attr_max_temp = 30.0 _attr_target_temperature_step = 1.0 @@ -155,7 +155,7 @@ class SamsungIrClimate( if (fan_mode := last_state.attributes.get(ATTR_FAN_MODE)) in HA_TO_LIB_FAN: self._attr_fan_mode = fan_mode if (temperature := last_state.attributes.get(ATTR_TEMPERATURE)) is not None: - self._attr_target_temperature = float(temperature) + self._attr_native_target_temperature = float(temperature) if self._attr_hvac_mode != HVACMode.OFF: self._last_on_hvac_mode = self._attr_hvac_mode @@ -184,7 +184,7 @@ class SamsungIrClimate( fan_mode = HA_TO_LIB_FAN.get(self._attr_fan_mode, SamsungACFanMode.AUTO) command = SamsungAC0292Command( hvac_mode=hvac_mode, - target_temperature=int(self._attr_target_temperature), + target_temperature=int(self._attr_native_target_temperature), fan_mode=fan_mode, swing_mode=SamsungACSwingMode.OFF, ) @@ -224,7 +224,7 @@ class SamsungIrClimate( self._attr_fan_mode = FAN_AUTO if (temperature := kwargs.get(ATTR_TEMPERATURE)) is not None: - self._attr_target_temperature = round(temperature) + self._attr_native_target_temperature = round(temperature) if ATTR_HVAC_MODE in kwargs or ATTR_TEMPERATURE in kwargs: await self._async_send_command() diff --git a/homeassistant/components/saunum/climate.py b/homeassistant/components/saunum/climate.py index c7574ce5ace4..b38d16b74b3b 100644 --- a/homeassistant/components/saunum/climate.py +++ b/homeassistant/components/saunum/climate.py @@ -74,7 +74,7 @@ class LeilSaunaClimate(LeilSaunaEntity, ClimateEntity): | ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.PRESET_MODE ) - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_precision = PRECISION_WHOLE _attr_target_temperature_step = 1.0 _attr_min_temp = MIN_TEMPERATURE @@ -116,13 +116,13 @@ class LeilSaunaClimate(LeilSaunaEntity, ClimateEntity): @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return the current temperature in Celsius.""" return self.coordinator.data.current_temperature @property @override - def target_temperature(self) -> float | None: + def native_target_temperature(self) -> float | None: """Return the target temperature in Celsius.""" return self.coordinator.data.target_temperature diff --git a/homeassistant/components/schluter/climate.py b/homeassistant/components/schluter/climate.py index 5b3388c44cbc..9707d241964c 100644 --- a/homeassistant/components/schluter/climate.py +++ b/homeassistant/components/schluter/climate.py @@ -84,7 +84,7 @@ class SchluterThermostat(CoordinatorEntity, ClimateEntity): _attr_hvac_mode = HVACMode.HEAT _attr_hvac_modes = [HVACMode.HEAT] _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, coordinator, serial_number, api, session_id): """Initialize the thermostat.""" @@ -102,7 +102,7 @@ class SchluterThermostat(CoordinatorEntity, ClimateEntity): @property @override - def current_temperature(self) -> float: + def native_current_temperature(self) -> float: """Return the current temperature.""" return self.coordinator.data[self._serial_number].temperature @@ -116,7 +116,7 @@ class SchluterThermostat(CoordinatorEntity, ClimateEntity): @property @override - def target_temperature(self) -> float: + def native_target_temperature(self) -> float: """Return the temperature we try to reach.""" return self.coordinator.data[self._serial_number].set_point_temp diff --git a/homeassistant/components/screenlogic/climate.py b/homeassistant/components/screenlogic/climate.py index 19c390c83ab5..8a45fc65d0a4 100644 --- a/homeassistant/components/screenlogic/climate.py +++ b/homeassistant/components/screenlogic/climate.py @@ -102,20 +102,20 @@ class ScreenLogicClimate(ScreenLogicPushEntity, ClimateEntity, RestoreEntity): @property @override - def current_temperature(self) -> float: + def native_current_temperature(self) -> float: """Return water temperature.""" return self.entity_data[VALUE.LAST_TEMPERATURE][ATTR.VALUE] @property @override - def target_temperature(self) -> float: + def native_target_temperature(self) -> float: """Target temperature.""" return self.entity_data[VALUE.HEAT_SETPOINT][ATTR.VALUE] @property @override - def temperature_unit(self) -> str: - """Return the unit of measurement.""" + def native_temperature_unit(self) -> str: + """Return the native unit of measurement.""" if self.gateway.temperature_unit == UNIT.CELSIUS: return UnitOfTemperature.CELSIUS return UnitOfTemperature.FAHRENHEIT diff --git a/homeassistant/components/sensibo/climate.py b/homeassistant/components/sensibo/climate.py index 718f4006710f..d95cdae015c0 100644 --- a/homeassistant/components/sensibo/climate.py +++ b/homeassistant/components/sensibo/climate.py @@ -138,7 +138,7 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity): """Initiate Sensibo Climate.""" super().__init__(coordinator, device_id) self._attr_unique_id = device_id - self._attr_temperature_unit = ( + self._attr_native_temperature_unit = ( UnitOfTemperature.CELSIUS if self.device_data.temp_unit == "C" else UnitOfTemperature.FAHRENHEIT @@ -178,20 +178,20 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity): @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return the current temperature.""" if self.device_data.temp: return TemperatureConverter.convert( self.device_data.temp, UnitOfTemperature.CELSIUS, - self.temperature_unit, + self.native_temperature_unit, ) return None @property @override - def temperature_unit(self) -> str: - """Return temperature unit.""" + def native_temperature_unit(self) -> str: + """Return the native temperature unit.""" return ( UnitOfTemperature.CELSIUS if self.device_data.temp_unit == "C" @@ -200,7 +200,7 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity): @property @override - def target_temperature(self) -> float | None: + def native_target_temperature(self) -> float | None: """Return the temperature we try to reach.""" return self.device_data.target_temp @@ -262,7 +262,7 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity): async def async_set_temperature(self, **kwargs: Any) -> None: """Set new target temperature.""" temperature: float = kwargs[ATTR_TEMPERATURE] - if temperature == self.target_temperature: + if temperature == self.native_target_temperature: return new_temp = _find_valid_target_temp(temperature, self.device_data.temp_list) diff --git a/homeassistant/components/senz/climate.py b/homeassistant/components/senz/climate.py index 279a51b84743..79a5cff06ad2 100644 --- a/homeassistant/components/senz/climate.py +++ b/homeassistant/components/senz/climate.py @@ -37,7 +37,7 @@ async def async_setup_entry( class SENZClimate(CoordinatorEntity[SENZDataUpdateCoordinator], ClimateEntity): """Representation of a SENZ climate entity.""" - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_precision = PRECISION_TENTHS _attr_hvac_modes = [HVACMode.HEAT, HVACMode.AUTO] _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE @@ -71,13 +71,13 @@ class SENZClimate(CoordinatorEntity[SENZDataUpdateCoordinator], ClimateEntity): @property @override - def current_temperature(self) -> float: + def native_current_temperature(self) -> float: """Return the current temperature.""" return self._thermostat.current_temperatue @property @override - def target_temperature(self) -> float: + def native_target_temperature(self) -> float: """Return the temperature we try to reach.""" return self._thermostat.setpoint_temperature diff --git a/homeassistant/components/shelly/climate.py b/homeassistant/components/shelly/climate.py index 2a5a70ab1e64..23a1081dd228 100644 --- a/homeassistant/components/shelly/climate.py +++ b/homeassistant/components/shelly/climate.py @@ -79,7 +79,7 @@ class RpcLinkedgoThermostatClimate(ShellyRpcAttributeEntity, ClimateEntity): """Entity that controls a LINKEDGO Thermostat on RPC based Shelly devices.""" entity_description: RpcClimateDescription - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_translation_key = "thermostat" _id: int @@ -182,7 +182,7 @@ class RpcLinkedgoThermostatClimate(ShellyRpcAttributeEntity, ClimateEntity): @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return the current temperature.""" if TYPE_CHECKING: assert self._current_temperature_key is not None @@ -191,7 +191,7 @@ class RpcLinkedgoThermostatClimate(ShellyRpcAttributeEntity, ClimateEntity): @property @override - def target_temperature(self) -> float | None: + def native_target_temperature(self) -> float | None: """Return the temperature we try to reach.""" return cast(float, self.attribute_value) @@ -424,7 +424,7 @@ class BlockSleepingClimate( | ClimateEntityFeature.TURN_ON ) _attr_target_temperature_step = SHTRV_01_TEMPERATURE_SETTINGS["step"] - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_has_entity_name = True def __init__( @@ -475,7 +475,7 @@ class BlockSleepingClimate( @property @override - def target_temperature(self) -> float | None: + def native_target_temperature(self) -> float | None: """Set target temperature.""" if self.block is not None: return cast(float, self.block.targetTemp) @@ -492,7 +492,7 @@ class BlockSleepingClimate( @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return current temperature.""" if self.block is not None: return cast(float, self.block.temp) @@ -561,8 +561,8 @@ class BlockSleepingClimate( def _check_is_off(self) -> bool: """Return if valve is off or on.""" return bool( - self.target_temperature is None - or (self.target_temperature <= self._attr_min_temp) + self.native_target_temperature is None + or (self.native_target_temperature <= self._attr_min_temp) ) async def set_state_full_path(self, **kwargs: Any) -> Any: @@ -611,8 +611,8 @@ class BlockSleepingClimate( async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: """Set hvac mode.""" if hvac_mode == HVACMode.OFF: - if isinstance(self.target_temperature, float): - self._last_target_temp = self.target_temperature + if isinstance(self.native_target_temperature, float): + self._last_target_temp = self.native_target_temperature await self.set_state_full_path( target_t_enabled=1, target_t=self._attr_min_temp ) @@ -719,7 +719,7 @@ class RpcClimate(ShellyRpcEntity, ClimateEntity): | ClimateEntityFeature.TURN_ON ) _attr_target_temperature_step = RPC_THERMOSTAT_SETTINGS["step"] - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, coordinator: ShellyRpcCoordinator, id_: int) -> None: """Initialize.""" @@ -743,13 +743,13 @@ class RpcClimate(ShellyRpcEntity, ClimateEntity): @property @override - def target_temperature(self) -> float | None: + def native_target_temperature(self) -> float | None: """Set target temperature.""" return cast(float, self.status["target_C"]) @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return current temperature.""" return cast(float, self.status["current_C"]) @@ -809,7 +809,7 @@ class RpcBluTrvClimate(ShellyRpcEntity, ClimateEntity): _attr_hvac_modes = [HVACMode.HEAT] _attr_hvac_mode = HVACMode.HEAT _attr_target_temperature_step = BLU_TRV_TEMPERATURE_SETTINGS["step"] - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS def __init__(self, coordinator: ShellyRpcCoordinator, id_: int) -> None: """Initialize.""" @@ -831,7 +831,7 @@ class RpcBluTrvClimate(ShellyRpcEntity, ClimateEntity): @property @override - def target_temperature(self) -> float | None: + def native_target_temperature(self) -> float | None: """Set target temperature.""" if not self._config["enable"]: return None @@ -840,7 +840,7 @@ class RpcBluTrvClimate(ShellyRpcEntity, ClimateEntity): @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return current temperature.""" return cast(float, self.status["current_C"]) diff --git a/homeassistant/components/smartthings/climate.py b/homeassistant/components/smartthings/climate.py index f91cf63d5285..3838e1d77d80 100644 --- a/homeassistant/components/smartthings/climate.py +++ b/homeassistant/components/smartthings/climate.py @@ -287,7 +287,7 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateEntity): @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return the current temperature.""" return self.get_attribute_value( Capability.TEMPERATURE_MEASUREMENT, Attribute.TEMPERATURE @@ -350,7 +350,7 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateEntity): @property @override - def target_temperature(self) -> float | None: + def native_target_temperature(self) -> float | None: """Return the temperature we try to reach.""" if self.hvac_mode == HVACMode.COOL: return self.get_attribute_value( @@ -364,7 +364,7 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateEntity): @property @override - def target_temperature_high(self) -> float | None: + def native_target_temperature_high(self) -> float | None: """Return the highbound target temperature we try to reach.""" if self.hvac_mode == HVACMode.HEAT_COOL: return self.get_attribute_value( @@ -374,7 +374,7 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateEntity): @property @override - def target_temperature_low(self) -> float | None: + def native_target_temperature_low(self) -> float | None: """Return the lowbound target temperature we try to reach.""" if self.hvac_mode == HVACMode.HEAT_COOL: return self.get_attribute_value( @@ -384,7 +384,7 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateEntity): @property @override - def temperature_unit(self) -> str: + def native_temperature_unit(self) -> str: """Return the unit of measurement.""" # Offline third party thermostats may not have a unit # Since climate always requires a unit, default to Celsius @@ -537,7 +537,7 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity): @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return the current temperature.""" return self.get_attribute_value( Capability.TEMPERATURE_MEASUREMENT, Attribute.TEMPERATURE @@ -597,7 +597,7 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity): @property @override - def target_temperature(self) -> float: + def native_target_temperature(self) -> float: """Return the temperature we try to reach.""" return self.get_attribute_value( Capability.THERMOSTAT_COOLING_SETPOINT, Attribute.COOLING_SETPOINT @@ -622,7 +622,7 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity): Attribute.COOLING_SETPOINT_RANGE ].unit ) is None: - return self.temperature_unit + return self.native_temperature_unit return UNIT_MAP[unit] @property @@ -632,7 +632,7 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity): if (step := self._get_setpoint_range_value("step")) is None: return None return TemperatureDeltaConverter.convert( - step, self._setpoint_range_unit, self.temperature_unit + step, self._setpoint_range_unit, self.native_temperature_unit ) def _get_custom_setpoint(self, attribute: Attribute) -> float | None: @@ -650,8 +650,8 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity): ].unit return TemperatureConverter.convert( setpoint, - UNIT_MAP[unit] if unit else self.temperature_unit, - self.temperature_unit, + UNIT_MAP[unit] if unit else self.native_temperature_unit, + self.native_temperature_unit, ) @property @@ -660,14 +660,14 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity): """Return the minimum temperature.""" if (minimum := self._get_setpoint_range_value("minimum")) is not None: return TemperatureConverter.convert( - minimum, self._setpoint_range_unit, self.temperature_unit + minimum, self._setpoint_range_unit, self.native_temperature_unit ) if ( minimum := self._get_custom_setpoint(Attribute.MINIMUM_SETPOINT) ) is not None: return minimum return TemperatureConverter.convert( - DEFAULT_MIN_TEMP, UnitOfTemperature.CELSIUS, self.temperature_unit + DEFAULT_MIN_TEMP, UnitOfTemperature.CELSIUS, self.native_temperature_unit ) @property @@ -676,19 +676,19 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity): """Return the maximum temperature.""" if (maximum := self._get_setpoint_range_value("maximum")) is not None: return TemperatureConverter.convert( - maximum, self._setpoint_range_unit, self.temperature_unit + maximum, self._setpoint_range_unit, self.native_temperature_unit ) if ( maximum := self._get_custom_setpoint(Attribute.MAXIMUM_SETPOINT) ) is not None: return maximum return TemperatureConverter.convert( - DEFAULT_MAX_TEMP, UnitOfTemperature.CELSIUS, self.temperature_unit + DEFAULT_MAX_TEMP, UnitOfTemperature.CELSIUS, self.native_temperature_unit ) @property @override - def temperature_unit(self) -> str: + def native_temperature_unit(self) -> str: """Return the unit of measurement.""" unit = self._internal_state[Capability.TEMPERATURE_MEASUREMENT][ Attribute.TEMPERATURE @@ -899,7 +899,7 @@ class SmartThingsHeatPumpZone(SmartThingsEntity, ClimateEntity): @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return the current temperature.""" return self.get_attribute_value( Capability.TEMPERATURE_MEASUREMENT, Attribute.TEMPERATURE @@ -919,7 +919,7 @@ class SmartThingsHeatPumpZone(SmartThingsEntity, ClimateEntity): @property @override - def target_temperature(self) -> float: + def native_target_temperature(self) -> float: """Return the temperature we try to reach.""" return self.get_attribute_value( Capability.THERMOSTAT_COOLING_SETPOINT, Attribute.COOLING_SETPOINT @@ -927,7 +927,7 @@ class SmartThingsHeatPumpZone(SmartThingsEntity, ClimateEntity): @property @override - def temperature_unit(self) -> str: + def native_temperature_unit(self) -> str: """Return the unit of measurement.""" unit = self._internal_state[Capability.TEMPERATURE_MEASUREMENT][ Attribute.TEMPERATURE diff --git a/homeassistant/components/smarttub/climate.py b/homeassistant/components/smarttub/climate.py index 4561eac60b0b..c276b898d7cb 100644 --- a/homeassistant/components/smarttub/climate.py +++ b/homeassistant/components/smarttub/climate.py @@ -68,7 +68,7 @@ class SmartTubThermostat(SmartTubEntity, ClimateEntity): _attr_supported_features = ( ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TARGET_TEMPERATURE ) - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_min_temp = DEFAULT_MIN_TEMP _attr_max_temp = DEFAULT_MAX_TEMP _attr_preset_modes = list(PRESET_MODES.values()) @@ -104,13 +104,13 @@ class SmartTubThermostat(SmartTubEntity, ClimateEntity): @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return the current water temperature.""" return self.spa_status.water.temperature @property @override - def target_temperature(self) -> float | None: + def native_target_temperature(self) -> float | None: """Return the target water temperature.""" return self.spa_status.set_temperature diff --git a/homeassistant/components/stiebel_eltron/climate.py b/homeassistant/components/stiebel_eltron/climate.py index 1833ffc8d8b0..5d33724088be 100644 --- a/homeassistant/components/stiebel_eltron/climate.py +++ b/homeassistant/components/stiebel_eltron/climate.py @@ -96,7 +96,7 @@ class StiebelEltron(StiebelEltronEntity, ClimateEntity): | ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON ) - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_target_temperature_step = PRECISION_TENTHS _attr_min_temp = 10.0 _attr_max_temp = 30.0 @@ -118,8 +118,8 @@ class StiebelEltron(StiebelEltronEntity, ClimateEntity): def _set_attr(self) -> None: lwz_api_client = self.coordinator.api_client - self._attr_target_temperature = lwz_api_client.get_target_temp() - self._attr_current_temperature = lwz_api_client.get_current_temp() + self._attr_native_target_temperature = lwz_api_client.get_target_temp() + self._attr_native_current_temperature = lwz_api_client.get_current_temp() self._attr_current_humidity = lwz_api_client.get_current_humidity() operation = lwz_api_client.get_operation() self._attr_hvac_mode = LWZ_TO_HA_HVAC.get(operation) diff --git a/homeassistant/components/switchbee/climate.py b/homeassistant/components/switchbee/climate.py index 2f3c5df07453..9b0796d4cf0f 100644 --- a/homeassistant/components/switchbee/climate.py +++ b/homeassistant/components/switchbee/climate.py @@ -99,7 +99,9 @@ class SwitchBeeClimateEntity(SwitchBeeDeviceEntity[SwitchBeeThermostat], Climate # set HVAC capabilities self._attr_max_temp = device.max_temperature self._attr_min_temp = device.min_temperature - self._attr_temperature_unit = HVAC_UNIT_SB_TO_HASS[device.temperature_unit] + self._attr_native_temperature_unit = HVAC_UNIT_SB_TO_HASS[ + device.temperature_unit + ] self._attr_hvac_modes = [HVAC_MODE_SB_TO_HASS[mode] for mode in device.modes] self._attr_hvac_modes.append(HVACMode.OFF) self._attr_supported_features = ( @@ -127,8 +129,8 @@ class SwitchBeeClimateEntity(SwitchBeeDeviceEntity[SwitchBeeThermostat], Climate else HVAC_MODE_SB_TO_HASS[coordinator_device.mode] ) self._attr_fan_mode = FAN_SB_TO_HASS[coordinator_device.fan] - self._attr_current_temperature = coordinator_device.temperature - self._attr_target_temperature = coordinator_device.target_temperature + self._attr_native_current_temperature = coordinator_device.temperature + self._attr_native_target_temperature = coordinator_device.target_temperature @override async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: @@ -169,7 +171,7 @@ class SwitchBeeClimateEntity(SwitchBeeDeviceEntity[SwitchBeeThermostat], Climate if fan is None: fan = FAN_HASS_TO_SB[self.fan_mode] if target_temperature is None: - target_temperature = int(self.target_temperature or 0) + target_temperature = int(self.native_target_temperature or 0) state: dict[str, int | str] = { ApiAttribute.POWER: power, diff --git a/homeassistant/components/switchbot/climate.py b/homeassistant/components/switchbot/climate.py index 8a3247da05e5..d96678037d01 100644 --- a/homeassistant/components/switchbot/climate.py +++ b/homeassistant/components/switchbot/climate.py @@ -63,7 +63,7 @@ class SwitchBotClimateEntity(SwitchbotEntity, ClimateEntity): | ClimateEntityFeature.TURN_ON ) _attr_target_temperature_step = 0.5 - _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_native_temperature_unit = UnitOfTemperature.CELSIUS _attr_translation_key = "climate" _attr_name = None @@ -118,13 +118,13 @@ class SwitchBotClimateEntity(SwitchbotEntity, ClimateEntity): @property @override - def current_temperature(self) -> float | None: + def native_current_temperature(self) -> float | None: """Return the current temperature.""" return self._device.current_temperature @property @override - def target_temperature(self) -> float | None: + def native_target_temperature(self) -> float | None: """Return the temperature we try to reach.""" return self._device.target_temperature