mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 08:07:45 +00:00
Use _attr_temperature_unit in climate entities (#77472)
This commit is contained in:
parent
8ed689fede
commit
0c401bcab2
@ -115,6 +115,8 @@ def format_target_temperature(target_temperature):
|
||||
class DaikinClimate(ClimateEntity):
|
||||
"""Representation of a Daikin HVAC."""
|
||||
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, api: DaikinApi) -> None:
|
||||
"""Initialize the climate device."""
|
||||
|
||||
@ -180,11 +182,6 @@ class DaikinClimate(ClimateEntity):
|
||||
"""Return a unique ID."""
|
||||
return self._api.device.mac
|
||||
|
||||
@property
|
||||
def temperature_unit(self) -> str:
|
||||
"""Return the unit of measurement which this thermostat uses."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def current_temperature(self):
|
||||
"""Return the current temperature."""
|
||||
|
@ -136,6 +136,8 @@ _PRESETS: EsphomeEnumMapper[ClimatePreset, str] = EsphomeEnumMapper(
|
||||
class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEntity):
|
||||
"""A climate implementation for ESPHome."""
|
||||
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def precision(self) -> float:
|
||||
"""Return the precision of the climate device."""
|
||||
@ -146,11 +148,6 @@ class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEnti
|
||||
# Fall back to highest precision, tenths
|
||||
return PRECISION_TENTHS
|
||||
|
||||
@property
|
||||
def temperature_unit(self) -> str:
|
||||
"""Return the unit of measurement used by the platform."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def hvac_modes(self) -> list[str]:
|
||||
"""Return the list of available operation modes."""
|
||||
|
@ -67,11 +67,7 @@ class FritzboxThermostat(FritzBoxEntity, ClimateEntity):
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||
)
|
||||
|
||||
@property
|
||||
def temperature_unit(self) -> str:
|
||||
"""Return the unit of measurement that is used."""
|
||||
return TEMP_CELSIUS
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def precision(self) -> float:
|
||||
|
@ -56,11 +56,7 @@ class HMThermostat(HMDevice, ClimateEntity):
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||
)
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement that is used."""
|
||||
return TEMP_CELSIUS
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def hvac_mode(self) -> HVACMode:
|
||||
|
@ -66,6 +66,7 @@ class HomematicipHeatingGroup(HomematicipGenericEntity, ClimateEntity):
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, hap: HomematicipHAP, device: AsyncHeatingGroup) -> None:
|
||||
"""Initialize heating group."""
|
||||
@ -86,11 +87,6 @@ class HomematicipHeatingGroup(HomematicipGenericEntity, ClimateEntity):
|
||||
via_device=(HMIPC_DOMAIN, self._device.homeId),
|
||||
)
|
||||
|
||||
@property
|
||||
def temperature_unit(self) -> str:
|
||||
"""Return the unit of measurement."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def target_temperature(self) -> float:
|
||||
"""Return the temperature we try to reach."""
|
||||
|
@ -37,6 +37,7 @@ class InComfortClimate(IncomfortChild, ClimateEntity):
|
||||
_attr_hvac_mode = HVACMode.HEAT
|
||||
_attr_hvac_modes = [HVACMode.HEAT]
|
||||
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, client, heater, room) -> None:
|
||||
"""Initialize the climate device."""
|
||||
@ -54,11 +55,6 @@ class InComfortClimate(IncomfortChild, ClimateEntity):
|
||||
"""Return the device state attributes."""
|
||||
return {"status": self._room.status}
|
||||
|
||||
@property
|
||||
def temperature_unit(self) -> str:
|
||||
"""Return the unit of measurement."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def current_temperature(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
|
@ -144,6 +144,7 @@ class IntesisAC(ClimateEntity):
|
||||
"""Represents an Intesishome air conditioning device."""
|
||||
|
||||
_attr_should_poll = False
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, ih_device_id, ih_device, controller):
|
||||
"""Initialize the thermostat."""
|
||||
@ -218,11 +219,6 @@ class IntesisAC(ClimateEntity):
|
||||
"""Return the name of the AC device."""
|
||||
return self._device_name
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Intesishome API uses celsius on the backend."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device specific state attributes."""
|
||||
|
@ -127,6 +127,7 @@ class ControllerDevice(ClimateEntity):
|
||||
"""Representation of iZone Controller."""
|
||||
|
||||
_attr_should_poll = False
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, controller: Controller) -> None:
|
||||
"""Initialise ControllerDevice."""
|
||||
@ -252,11 +253,6 @@ class ControllerDevice(ClimateEntity):
|
||||
"""Return the name of the entity."""
|
||||
return f"iZone Controller {self._controller.device_uid}"
|
||||
|
||||
@property
|
||||
def temperature_unit(self) -> str:
|
||||
"""Return the unit of measurement which this thermostat uses."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def precision(self) -> float:
|
||||
"""Return the precision of the system."""
|
||||
@ -443,6 +439,7 @@ class ZoneDevice(ClimateEntity):
|
||||
"""Representation of iZone Zone."""
|
||||
|
||||
_attr_should_poll = False
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, controller: ControllerDevice, zone: Zone) -> None:
|
||||
"""Initialise ZoneDevice."""
|
||||
@ -529,11 +526,6 @@ class ZoneDevice(ClimateEntity):
|
||||
return self._attr_supported_features
|
||||
return self._attr_supported_features & ~ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement which this thermostat uses."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def precision(self):
|
||||
"""Return the precision of the system."""
|
||||
|
@ -58,6 +58,7 @@ class MelissaClimate(ClimateEntity):
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, api, serial_number, init_data):
|
||||
"""Initialize the climate device."""
|
||||
@ -124,11 +125,6 @@ class MelissaClimate(ClimateEntity):
|
||||
return None
|
||||
return self._cur_settings[self._api.TEMP]
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement which this thermostat uses."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def min_temp(self):
|
||||
"""Return the minimum supported temperature for the thermostat."""
|
||||
|
@ -64,6 +64,7 @@ class ThermostatDevice(ClimateEntity):
|
||||
|
||||
_attr_hvac_modes = SUPPORT_HVAC
|
||||
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, thermostat, name):
|
||||
"""Initialize the device."""
|
||||
@ -93,11 +94,6 @@ class ThermostatDevice(ClimateEntity):
|
||||
"""Return the name of this Thermostat."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement used by the platform."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def hvac_action(self) -> HVACAction:
|
||||
"""Return current hvac i.e. heat, cool, idle."""
|
||||
|
@ -66,6 +66,7 @@ class OpenThermClimate(ClimateEntity):
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, gw_dev, options):
|
||||
"""Initialize the device."""
|
||||
@ -202,11 +203,6 @@ class OpenThermClimate(ClimateEntity):
|
||||
return PRECISION_HALVES
|
||||
return PRECISION_WHOLE
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement used by the platform."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def hvac_action(self) -> HVACAction | None:
|
||||
"""Return current HVAC operation."""
|
||||
|
@ -55,6 +55,7 @@ class ProliphixThermostat(ClimateEntity):
|
||||
"""Representation a Proliphix thermostat."""
|
||||
|
||||
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
_attr_temperature_unit = TEMP_FAHRENHEIT
|
||||
|
||||
def __init__(self, pdp):
|
||||
"""Initialize the thermostat."""
|
||||
@ -85,11 +86,6 @@ class ProliphixThermostat(ClimateEntity):
|
||||
"""Return the device specific state attributes."""
|
||||
return {ATTR_FAN: self._pdp.fan_state}
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement."""
|
||||
return TEMP_FAHRENHEIT
|
||||
|
||||
@property
|
||||
def current_temperature(self):
|
||||
"""Return the current temperature."""
|
||||
|
@ -82,6 +82,7 @@ class SchluterThermostat(CoordinatorEntity, ClimateEntity):
|
||||
_attr_hvac_mode = HVACMode.HEAT
|
||||
_attr_hvac_modes = [HVACMode.HEAT]
|
||||
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, coordinator, serial_number, api, session_id):
|
||||
"""Initialize the thermostat."""
|
||||
@ -100,11 +101,6 @@ class SchluterThermostat(CoordinatorEntity, ClimateEntity):
|
||||
"""Return the name of the thermostat."""
|
||||
return self.coordinator.data[self._serial_number].name
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Schluter API always uses celsius."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def current_temperature(self):
|
||||
"""Return the current temperature."""
|
||||
|
@ -61,16 +61,12 @@ class SmartTubThermostat(SmartTubEntity, ClimateEntity):
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, coordinator, spa):
|
||||
"""Initialize the entity."""
|
||||
super().__init__(coordinator, spa, "Thermostat")
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement used by the platform."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def hvac_action(self) -> HVACAction | None:
|
||||
"""Return the current running hvac operation."""
|
||||
|
@ -35,6 +35,8 @@ async def async_setup_entry(
|
||||
class SpiderThermostat(ClimateEntity):
|
||||
"""Representation of a thermostat."""
|
||||
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, api, thermostat):
|
||||
"""Initialize the thermostat."""
|
||||
self.api = api
|
||||
@ -75,11 +77,6 @@ class SpiderThermostat(ClimateEntity):
|
||||
"""Return the name of the thermostat, if any."""
|
||||
return self.thermostat.name
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def current_temperature(self):
|
||||
"""Return the current temperature."""
|
||||
|
@ -74,6 +74,7 @@ class StiebelEltron(ClimateEntity):
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, name, ste_data):
|
||||
"""Initialize the unit."""
|
||||
@ -112,10 +113,6 @@ class StiebelEltron(ClimateEntity):
|
||||
return self._name
|
||||
|
||||
# Handle ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def current_temperature(self):
|
||||
|
@ -213,6 +213,8 @@ def create_climate_entity(tado, name: str, zone_id: int, device_info: dict):
|
||||
class TadoClimate(TadoZoneEntity, ClimateEntity):
|
||||
"""Representation of a Tado climate entity."""
|
||||
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
tado,
|
||||
@ -367,11 +369,6 @@ class TadoClimate(TadoZoneEntity, ClimateEntity):
|
||||
"""Set new preset mode."""
|
||||
self._tado.set_presence(preset_mode)
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement used by the platform."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def target_temperature_step(self):
|
||||
"""Return the supported step of target temperature."""
|
||||
|
@ -82,6 +82,7 @@ class TfiacClimate(ClimateEntity):
|
||||
| ClimateEntityFeature.SWING_MODE
|
||||
| ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_FAHRENHEIT
|
||||
|
||||
def __init__(self, hass, client):
|
||||
"""Init class."""
|
||||
@ -121,11 +122,6 @@ class TfiacClimate(ClimateEntity):
|
||||
"""Return the temperature we try to reach."""
|
||||
return self._client.status["target_temp"]
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement."""
|
||||
return TEMP_FAHRENHEIT
|
||||
|
||||
@property
|
||||
def current_temperature(self):
|
||||
"""Return the current temperature."""
|
||||
|
@ -64,6 +64,7 @@ class Touchline(ClimateEntity):
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, touchline_thermostat):
|
||||
"""Initialize the Touchline device."""
|
||||
@ -89,11 +90,6 @@ class Touchline(ClimateEntity):
|
||||
"""Return the name of the climate device."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def current_temperature(self):
|
||||
"""Return the current temperature."""
|
||||
|
@ -145,6 +145,7 @@ class ViCareClimate(ClimateEntity):
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, name, api, circuit, device_config, heating_type):
|
||||
"""Initialize the climate device."""
|
||||
@ -249,11 +250,6 @@ class ViCareClimate(ClimateEntity):
|
||||
"""Return the name of the climate device."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def current_temperature(self):
|
||||
"""Return the current temperature."""
|
||||
|
@ -137,6 +137,8 @@ class Thermostat(ZhaEntity, ClimateEntity):
|
||||
DEFAULT_MAX_TEMP = 35
|
||||
DEFAULT_MIN_TEMP = 7
|
||||
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, unique_id, zha_device, channels, **kwargs):
|
||||
"""Initialize ZHA Thermostat instance."""
|
||||
super().__init__(unique_id, zha_device, channels, **kwargs)
|
||||
@ -334,11 +336,6 @@ class Thermostat(ZhaEntity, ClimateEntity):
|
||||
return temp
|
||||
return round(temp / ZCL_TEMP, 1)
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement used by the platform."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def max_temp(self) -> float:
|
||||
"""Return the maximum temperature."""
|
||||
|
@ -128,6 +128,7 @@ class ZhongHongClimate(ClimateEntity):
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
def __init__(self, hub, addr_out, addr_in):
|
||||
"""Set up the ZhongHong climate devices."""
|
||||
@ -171,11 +172,6 @@ class ZhongHongClimate(ClimateEntity):
|
||||
"""Return the unique ID of the HVAC."""
|
||||
return f"zhong_hong_hvac_{self._device.addr_out}_{self._device.addr_in}"
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement used by the platform."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def hvac_mode(self) -> HVACMode:
|
||||
"""Return current operation ie. heat, cool, idle."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user