Rename ClimateDevice to ClimateEntity (#34591)
This commit is contained in:
1 parent
b30d117e7d
commit
29bc93ea98
68 files changed
+177
-150
No files matched your search
@@ -101,7 +101,7 @@ SET_TEMPERATURE_SCHEMA = vol.All(
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
||||
"""Set up climate devices."""
|
||||
"""Set up climate entities."""
|
||||
component = hass.data[DOMAIN] = EntityComponent(
|
||||
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
|
||||
)
|
||||
@@ -156,8 +156,8 @@ async def async_unload_entry(hass: HomeAssistantType, entry):
|
||||
return await hass.data[DOMAIN].async_unload_entry(entry)
|
||||
|
||||
|
||||
class ClimateDevice(Entity):
|
||||
"""Representation of a climate device."""
|
||||
class ClimateEntity(Entity):
|
||||
"""Representation of a climate entity."""
|
||||
|
||||
@property
|
||||
def state(self) -> str:
|
||||
@@ -509,7 +509,7 @@ class ClimateDevice(Entity):
|
||||
|
||||
|
||||
async def async_service_aux_heat(
|
||||
entity: ClimateDevice, service: ServiceDataType
|
||||
entity: ClimateEntity, service: ServiceDataType
|
||||
) -> None:
|
||||
"""Handle aux heat service."""
|
||||
if service.data[ATTR_AUX_HEAT]:
|
||||
@@ -519,7 +519,7 @@ async def async_service_aux_heat(
|
||||
|
||||
|
||||
async def async_service_temperature_set(
|
||||
entity: ClimateDevice, service: ServiceDataType
|
||||
entity: ClimateEntity, service: ServiceDataType
|
||||
) -> None:
|
||||
"""Handle set temperature service."""
|
||||
hass = entity.hass
|
||||
@@ -534,3 +534,15 @@ async def async_service_temperature_set(
|
||||
kwargs[value] = temp
|
||||
|
||||
await entity.async_set_temperature(**kwargs)
|
||||
|
||||
|
||||
class ClimateDevice(ClimateEntity):
|
||||
"""Representation of a climate entity (for backwards compatibility)."""
|
||||
|
||||
def __init_subclass__(cls, **kwargs):
|
||||
"""Print deprecation warning."""
|
||||
super().__init_subclass__(**kwargs)
|
||||
_LOGGER.warning(
|
||||
"ClimateDevice is deprecated, modify %s to extend ClimateEntity",
|
||||
cls.__name__,
|
||||
)
|
||||
Reference in new issue
Block a user