Migrate Melcloud to has entity name (#99025)

This commit is contained in:
ollo69 2023-08-30 10:53:52 +02:00 committed by GitHub
parent e7462e916a
commit a89a5f486d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 67 additions and 48 deletions

View file

@ -99,6 +99,8 @@ class MelCloudClimate(ClimateEntity):
"""Base climate device."""
_attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_has_entity_name = True
_attr_name = None
def __init__(self, device: MelCloudDevice) -> None:
"""Initialize the climate."""
@ -109,11 +111,6 @@ class MelCloudClimate(ClimateEntity):
"""Update state from MELCloud."""
await self.api.async_update()
@property
def device_info(self):
"""Return a device description for device registry."""
return self.api.device_info
@property
def target_temperature_step(self) -> float | None:
"""Return the supported step of target temperature."""
@ -134,8 +131,8 @@ class AtaDeviceClimate(MelCloudClimate):
super().__init__(device)
self._device = ata_device
self._attr_name = device.name
self._attr_unique_id = f"{self.api.device.serial}-{self.api.device.mac}"
self._attr_device_info = self.api.device_info
@property
def extra_state_attributes(self) -> dict[str, Any] | None:
@ -310,8 +307,8 @@ class AtwDeviceZoneClimate(MelCloudClimate):
self._device = atw_device
self._zone = atw_zone
self._attr_name = f"{device.name} {self._zone.name}"
self._attr_unique_id = f"{self.api.device.serial}-{atw_zone.zone_index}"
self._attr_device_info = self.api.zone_device_info(atw_zone)
@property
def extra_state_attributes(self) -> dict[str, Any]: