Use UnitOfTemperature in climate entities [m-s] (#83131)
parent
d3b35ca2a7
commit
8b867d612f
|
@ -23,7 +23,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
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
@ -79,7 +79,7 @@ class MaxCubeClimate(ClimateEntity):
|
|||
self._device = device
|
||||
self._attr_should_poll = True
|
||||
self._attr_unique_id = self._device.serial
|
||||
self._attr_temperature_unit = TEMP_CELSIUS
|
||||
self._attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
self._attr_preset_modes = [
|
||||
PRESET_NONE,
|
||||
PRESET_BOOST,
|
||||
|
|
|
@ -23,7 +23,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 import config_validation as cv, entity_platform
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -98,7 +98,7 @@ async def async_setup_entry(
|
|||
class MelCloudClimate(ClimateEntity):
|
||||
"""Base climate device."""
|
||||
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(self, device: MelCloudDevice) -> None:
|
||||
"""Initialize the climate."""
|
||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.components.climate import (
|
|||
ClimateEntityFeature,
|
||||
HVACMode,
|
||||
)
|
||||
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
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
@ -59,7 +59,7 @@ class MelissaClimate(ClimateEntity):
|
|||
_attr_supported_features = (
|
||||
ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(self, api, serial_number, init_data):
|
||||
"""Initialize the climate device."""
|
||||
|
|
|
@ -19,7 +19,7 @@ from homeassistant.const import (
|
|||
CONF_USERNAME,
|
||||
PRECISION_HALVES,
|
||||
PRECISION_WHOLE,
|
||||
TEMP_CELSIUS,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, ServiceCall, callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
@ -92,7 +92,7 @@ class MillHeater(CoordinatorEntity, ClimateEntity):
|
|||
_attr_fan_modes = [FAN_ON, FAN_OFF]
|
||||
_attr_max_temp = MAX_TEMP
|
||||
_attr_min_temp = MIN_TEMP
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(self, coordinator, heater):
|
||||
"""Initialize the thermostat."""
|
||||
|
@ -205,7 +205,7 @@ class LocalMillHeater(CoordinatorEntity, ClimateEntity):
|
|||
_attr_min_temp = MIN_TEMP
|
||||
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
_attr_target_temperature_step = PRECISION_HALVES
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(self, coordinator):
|
||||
"""Initialize the thermostat."""
|
||||
|
|
|
@ -17,8 +17,7 @@ from homeassistant.const import (
|
|||
CONF_TEMPERATURE_UNIT,
|
||||
PRECISION_TENTHS,
|
||||
PRECISION_WHOLE,
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -89,7 +88,9 @@ class ModbusThermostat(BaseStructPlatform, RestoreEntity, ClimateEntity):
|
|||
self._attr_current_temperature = None
|
||||
self._attr_target_temperature = None
|
||||
self._attr_temperature_unit = (
|
||||
TEMP_FAHRENHEIT if self._unit == "F" else TEMP_CELSIUS
|
||||
UnitOfTemperature.FAHRENHEIT
|
||||
if self._unit == "F"
|
||||
else UnitOfTemperature.CELSIUS
|
||||
)
|
||||
self._attr_precision = (
|
||||
PRECISION_TENTHS if self._precision >= 1 else PRECISION_WHOLE
|
||||
|
|
|
@ -9,7 +9,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
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
@ -45,7 +45,7 @@ class Alpha2Climate(CoordinatorEntity[Alpha2BaseCoordinator], ClimateEntity):
|
|||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||
)
|
||||
_attr_hvac_modes = [HVACMode.HEAT, HVACMode.COOL]
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
_attr_preset_modes = [PRESET_AUTO, PRESET_DAY, PRESET_NIGHT]
|
||||
|
||||
def __init__(self, coordinator: Alpha2BaseCoordinator, heat_area_id: str) -> None:
|
||||
|
|
|
@ -11,12 +11,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.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -96,7 +91,9 @@ class MySensorsHVAC(mysensors.device.MySensorsEntity, ClimateEntity):
|
|||
def temperature_unit(self) -> str:
|
||||
"""Return the unit of measurement."""
|
||||
return (
|
||||
TEMP_CELSIUS if self.hass.config.units is METRIC_SYSTEM else TEMP_FAHRENHEIT
|
||||
UnitOfTemperature.CELSIUS
|
||||
if self.hass.config.units is METRIC_SYSTEM
|
||||
else UnitOfTemperature.FAHRENHEIT
|
||||
)
|
||||
|
||||
@property
|
||||
|
|
|
@ -23,7 +23,7 @@ from homeassistant.const import (
|
|||
ATTR_TEMPERATURE,
|
||||
PRECISION_HALVES,
|
||||
STATE_OFF,
|
||||
TEMP_CELSIUS,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||
|
@ -134,7 +134,7 @@ class NetatmoThermostat(NetatmoBase, ClimateEntity):
|
|||
_attr_preset_modes = SUPPORT_PRESET
|
||||
_attr_supported_features = SUPPORT_FLAGS
|
||||
_attr_target_temperature_step = PRECISION_HALVES
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(self, netatmo_device: NetatmoRoom) -> None:
|
||||
"""Initialize the sensor."""
|
||||
|
|
|
@ -31,7 +31,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
|
||||
from homeassistant.helpers import entity_platform
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -178,7 +178,9 @@ class NexiaZone(NexiaThermostatZoneEntity, ClimateEntity):
|
|||
self._attr_max_humidity = percent_conv(max_humidity)
|
||||
self._attr_min_temp = min_setpoint
|
||||
self._attr_max_temp = max_setpoint
|
||||
self._attr_temperature_unit = TEMP_CELSIUS if unit == "C" else TEMP_FAHRENHEIT
|
||||
self._attr_temperature_unit = (
|
||||
UnitOfTemperature.CELSIUS if unit == "C" else UnitOfTemperature.FAHRENHEIT
|
||||
)
|
||||
self._attr_target_temperature_step = 0.5 if unit == "C" else 1.0
|
||||
|
||||
@property
|
||||
|
|
|
@ -24,7 +24,7 @@ from homeassistant.const import (
|
|||
ATTR_SUGGESTED_AREA,
|
||||
ATTR_VIA_DEVICE,
|
||||
PRECISION_TENTHS,
|
||||
TEMP_CELSIUS,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
@ -84,7 +84,7 @@ class NoboZone(ClimateEntity):
|
|||
_attr_precision = PRECISION_TENTHS
|
||||
_attr_preset_modes = PRESET_MODES
|
||||
_attr_supported_features = SUPPORT_FLAGS
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
_attr_target_temperature_step = 1
|
||||
# Need to poll to get preset change when in HVACMode.AUTO, so can't set _attr_should_poll = False
|
||||
|
||||
|
|
|
@ -18,7 +18,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 import event as event_helper
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
@ -93,9 +93,9 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity):
|
|||
def temperature_unit(self) -> str:
|
||||
"""Return the unit of measurement."""
|
||||
if self._temperature_unit == "C":
|
||||
return TEMP_CELSIUS
|
||||
return UnitOfTemperature.CELSIUS
|
||||
|
||||
return TEMP_FAHRENHEIT
|
||||
return UnitOfTemperature.FAHRENHEIT
|
||||
|
||||
@property
|
||||
def current_temperature(self):
|
||||
|
|
|
@ -21,7 +21,7 @@ from homeassistant.const import (
|
|||
CONF_PASSWORD,
|
||||
CONF_PORT,
|
||||
CONF_USERNAME,
|
||||
TEMP_CELSIUS,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -67,7 +67,7 @@ class ThermostatDevice(ClimateEntity):
|
|||
|
||||
_attr_hvac_modes = SUPPORT_HVAC
|
||||
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(self, thermostat, name):
|
||||
"""Initialize the device."""
|
||||
|
|
|
@ -22,7 +22,7 @@ from homeassistant.const import (
|
|||
PRECISION_HALVES,
|
||||
PRECISION_TENTHS,
|
||||
PRECISION_WHOLE,
|
||||
TEMP_CELSIUS,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
@ -68,7 +68,7 @@ class OpenThermClimate(ClimateEntity):
|
|||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(self, gw_dev, options):
|
||||
"""Initialize the device."""
|
||||
|
@ -201,7 +201,7 @@ class OpenThermClimate(ClimateEntity):
|
|||
"""Return the precision of the system."""
|
||||
if self.temp_read_precision:
|
||||
return self.temp_read_precision
|
||||
if self.hass.config.units.temperature_unit == TEMP_CELSIUS:
|
||||
if self.hass.config.units.temperature_unit == UnitOfTemperature.CELSIUS:
|
||||
return PRECISION_HALVES
|
||||
return PRECISION_WHOLE
|
||||
|
||||
|
@ -247,7 +247,7 @@ class OpenThermClimate(ClimateEntity):
|
|||
"""Return the supported step of target temperature."""
|
||||
if self.temp_set_precision:
|
||||
return self.temp_set_precision
|
||||
if self.hass.config.units.temperature_unit == TEMP_CELSIUS:
|
||||
if self.hass.config.units.temperature_unit == UnitOfTemperature.CELSIUS:
|
||||
return PRECISION_HALVES
|
||||
return PRECISION_WHOLE
|
||||
|
||||
|
|
|
@ -13,7 +13,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.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -41,7 +41,7 @@ async def async_setup_entry(
|
|||
class PlugwiseClimateEntity(PlugwiseEntity, ClimateEntity):
|
||||
"""Representation of an Plugwise thermostat."""
|
||||
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -19,7 +19,7 @@ from homeassistant.const import (
|
|||
CONF_PASSWORD,
|
||||
CONF_USERNAME,
|
||||
PRECISION_TENTHS,
|
||||
TEMP_FAHRENHEIT,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -59,7 +59,7 @@ class ProliphixThermostat(ClimateEntity):
|
|||
|
||||
_attr_precision = PRECISION_TENTHS
|
||||
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
_attr_temperature_unit = TEMP_FAHRENHEIT
|
||||
_attr_temperature_unit = UnitOfTemperature.FAHRENHEIT
|
||||
|
||||
def __init__(self, pdp):
|
||||
"""Initialize the thermostat."""
|
||||
|
|
|
@ -24,7 +24,7 @@ from homeassistant.const import (
|
|||
ATTR_TEMPERATURE,
|
||||
CONF_HOST,
|
||||
PRECISION_HALVES,
|
||||
TEMP_FAHRENHEIT,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -169,7 +169,7 @@ class RadioThermostat(RadioThermostatEntity, ClimateEntity):
|
|||
"""Representation of a Radio Thermostat."""
|
||||
|
||||
_attr_hvac_modes = OPERATION_LIST
|
||||
_attr_temperature_unit = TEMP_FAHRENHEIT
|
||||
_attr_temperature_unit = UnitOfTemperature.FAHRENHEIT
|
||||
_attr_precision = PRECISION_HALVES
|
||||
|
||||
def __init__(self, coordinator: RadioThermUpdateCoordinator) -> None:
|
||||
|
|
|
@ -10,13 +10,12 @@ import voluptuous as vol
|
|||
from homeassistant.components.climate import (
|
||||
PLATFORM_SCHEMA,
|
||||
SCAN_INTERVAL,
|
||||
TEMP_CELSIUS,
|
||||
ClimateEntity,
|
||||
ClimateEntityFeature,
|
||||
HVACAction,
|
||||
HVACMode,
|
||||
)
|
||||
from homeassistant.const import ATTR_TEMPERATURE, CONF_SCAN_INTERVAL
|
||||
from homeassistant.const import ATTR_TEMPERATURE, CONF_SCAN_INTERVAL, UnitOfTemperature
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
@ -81,7 +80,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
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(self, coordinator, serial_number, api, session_id):
|
||||
"""Initialize the thermostat."""
|
||||
|
|
|
@ -12,7 +12,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
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -98,8 +98,8 @@ class ScreenLogicClimate(ScreenlogicEntity, ClimateEntity, RestoreEntity):
|
|||
def temperature_unit(self) -> str:
|
||||
"""Return the unit of measurement."""
|
||||
if self.config_data["is_celsius"]["value"] == 1:
|
||||
return TEMP_CELSIUS
|
||||
return TEMP_FAHRENHEIT
|
||||
return UnitOfTemperature.CELSIUS
|
||||
return UnitOfTemperature.FAHRENHEIT
|
||||
|
||||
@property
|
||||
def hvac_mode(self) -> HVACMode:
|
||||
|
|
|
@ -19,8 +19,7 @@ from homeassistant.const import (
|
|||
ATTR_STATE,
|
||||
ATTR_TEMPERATURE,
|
||||
PRECISION_TENTHS,
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
@ -171,7 +170,9 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity):
|
|||
super().__init__(coordinator, device_id)
|
||||
self._attr_unique_id = device_id
|
||||
self._attr_temperature_unit = (
|
||||
TEMP_CELSIUS if self.device_data.temp_unit == "C" else TEMP_FAHRENHEIT
|
||||
UnitOfTemperature.CELSIUS
|
||||
if self.device_data.temp_unit == "C"
|
||||
else UnitOfTemperature.FAHRENHEIT
|
||||
)
|
||||
self._attr_supported_features = self.get_features()
|
||||
self._attr_precision = PRECISION_TENTHS
|
||||
|
@ -212,7 +213,7 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity):
|
|||
if self.device_data.temp:
|
||||
return TemperatureConverter.convert(
|
||||
self.device_data.temp,
|
||||
TEMP_CELSIUS,
|
||||
UnitOfTemperature.CELSIUS,
|
||||
self.temperature_unit,
|
||||
)
|
||||
return None
|
||||
|
@ -220,7 +221,11 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity):
|
|||
@property
|
||||
def temperature_unit(self) -> str:
|
||||
"""Return temperature unit."""
|
||||
return TEMP_CELSIUS if self.device_data.temp_unit == "C" else TEMP_FAHRENHEIT
|
||||
return (
|
||||
UnitOfTemperature.CELSIUS
|
||||
if self.device_data.temp_unit == "C"
|
||||
else UnitOfTemperature.FAHRENHEIT
|
||||
)
|
||||
|
||||
@property
|
||||
def target_temperature(self) -> float | None:
|
||||
|
@ -464,10 +469,14 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity):
|
|||
|
||||
if high_temperature_state.get("temperatureUnit") == "F":
|
||||
high_temp = TemperatureConverter.convert(
|
||||
high_temperature_threshold, TEMP_FAHRENHEIT, TEMP_CELSIUS
|
||||
high_temperature_threshold,
|
||||
UnitOfTemperature.FAHRENHEIT,
|
||||
UnitOfTemperature.CELSIUS,
|
||||
)
|
||||
low_temp = TemperatureConverter.convert(
|
||||
low_temperature_threshold, TEMP_FAHRENHEIT, TEMP_CELSIUS
|
||||
low_temperature_threshold,
|
||||
UnitOfTemperature.FAHRENHEIT,
|
||||
UnitOfTemperature.CELSIUS,
|
||||
)
|
||||
|
||||
params: dict[str, str | bool | float | dict] = {
|
||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.components.climate import (
|
|||
HVACMode,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, TEMP_CELSIUS
|
||||
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, UnitOfTemperature
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -37,7 +37,7 @@ async def async_setup_entry(
|
|||
class SENZClimate(CoordinatorEntity, ClimateEntity):
|
||||
"""Representation of a SENZ climate entity."""
|
||||
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
_attr_precision = PRECISION_TENTHS
|
||||
_attr_hvac_modes = [HVACMode.HEAT, HVACMode.AUTO]
|
||||
_attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
|
|
|
@ -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, State, callback
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import device_registry, entity_registry
|
||||
|
@ -108,7 +108,7 @@ class BlockSleepingClimate(
|
|||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||
)
|
||||
_attr_target_temperature_step = SHTRV_01_TEMPERATURE_SETTINGS["step"]
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
|
@ -19,7 +19,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
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
|
@ -71,7 +71,7 @@ STATE_TO_AC_MODE = {
|
|||
HVACMode.FAN_ONLY: "fanOnly",
|
||||
}
|
||||
|
||||
UNIT_MAP = {"C": TEMP_CELSIUS, "F": TEMP_FAHRENHEIT}
|
||||
UNIT_MAP = {"C": UnitOfTemperature.CELSIUS, "F": UnitOfTemperature.FAHRENHEIT}
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -14,7 +14,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
|
||||
from homeassistant.util.unit_conversion import TemperatureConverter
|
||||
|
@ -63,7 +63,7 @@ class SmartTubThermostat(SmartTubEntity, ClimateEntity):
|
|||
_attr_supported_features = (
|
||||
ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(self, coordinator, spa):
|
||||
"""Initialize the entity."""
|
||||
|
@ -88,7 +88,7 @@ class SmartTubThermostat(SmartTubEntity, ClimateEntity):
|
|||
"""Return the minimum temperature."""
|
||||
min_temp = DEFAULT_MIN_TEMP
|
||||
return TemperatureConverter.convert(
|
||||
min_temp, TEMP_CELSIUS, self.temperature_unit
|
||||
min_temp, UnitOfTemperature.CELSIUS, self.temperature_unit
|
||||
)
|
||||
|
||||
@property
|
||||
|
@ -96,7 +96,7 @@ class SmartTubThermostat(SmartTubEntity, ClimateEntity):
|
|||
"""Return the maximum temperature."""
|
||||
max_temp = DEFAULT_MAX_TEMP
|
||||
return TemperatureConverter.convert(
|
||||
max_temp, TEMP_CELSIUS, self.temperature_unit
|
||||
max_temp, UnitOfTemperature.CELSIUS, self.temperature_unit
|
||||
)
|
||||
|
||||
@property
|
||||
|
|
|
@ -7,7 +7,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 import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -40,7 +40,7 @@ async def async_setup_entry(
|
|||
class SpiderThermostat(ClimateEntity):
|
||||
"""Representation of a thermostat."""
|
||||
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(self, api, thermostat):
|
||||
"""Initialize the thermostat."""
|
||||
|
|
|
@ -10,7 +10,7 @@ from homeassistant.components.climate import (
|
|||
ClimateEntityFeature,
|
||||
HVACMode,
|
||||
)
|
||||
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
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
@ -75,7 +75,7 @@ class StiebelEltron(ClimateEntity):
|
|||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||
)
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
def __init__(self, name, ste_data):
|
||||
"""Initialize the unit."""
|
||||
|
|
|
@ -23,7 +23,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.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -65,8 +65,8 @@ HVAC_ACTION_SB_TO_HASS = {
|
|||
}
|
||||
|
||||
HVAC_UNIT_SB_TO_HASS = {
|
||||
ThermostatTemperatureUnit.CELSIUS: TEMP_CELSIUS,
|
||||
ThermostatTemperatureUnit.FAHRENHEIT: TEMP_FAHRENHEIT,
|
||||
ThermostatTemperatureUnit.CELSIUS: UnitOfTemperature.CELSIUS,
|
||||
ThermostatTemperatureUnit.FAHRENHEIT: UnitOfTemperature.FAHRENHEIT,
|
||||
}
|
||||
|
||||
SUPPORTED_FAN_MODES = [FAN_AUTO, FAN_HIGH, FAN_MEDIUM, FAN_LOW]
|
||||
|
|
|
@ -26,7 +26,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.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import device_registry
|
||||
|
@ -102,7 +102,7 @@ class SwitcherClimateEntity(
|
|||
self._attr_min_temp = remote.min_temperature
|
||||
self._attr_max_temp = remote.max_temperature
|
||||
self._attr_target_temperature_step = 1
|
||||
self._attr_temperature_unit = TEMP_CELSIUS
|
||||
self._attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||
|
||||
self._attr_hvac_modes = [HVACMode.OFF]
|
||||
for mode in remote.modes_features:
|
||||
|
|
Loading…
Reference in New Issue