Migrate Gree to has entity name (#104739)
* Migrate Gree to has entity name * Migrate Gree to has entity name
This commit is contained in:
parent
c4d77877d2
commit
00e87b9dff
6 changed files with 58 additions and 49 deletions
|
@ -9,13 +9,15 @@ from .const import DOMAIN
|
|||
class GreeEntity(CoordinatorEntity[DeviceDataUpdateCoordinator]):
|
||||
"""Generic Gree entity (base class)."""
|
||||
|
||||
def __init__(self, coordinator: DeviceDataUpdateCoordinator, desc: str) -> None:
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self, coordinator: DeviceDataUpdateCoordinator, desc: str | None = None
|
||||
) -> None:
|
||||
"""Initialize the entity."""
|
||||
super().__init__(coordinator)
|
||||
self._desc = desc
|
||||
name = coordinator.device.device_info.name
|
||||
mac = coordinator.device.device_info.mac
|
||||
self._attr_name = f"{name} {desc}"
|
||||
self._attr_unique_id = f"{mac}_{desc}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
connections={(CONNECTION_NETWORK_MAC, mac)},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue