Migrate Dynalite to has entity name (#96569)

This commit is contained in:
Joost Lekkerkerker 2023-07-18 09:58:42 +02:00 committed by GitHub
parent 1097bde71b
commit 65db77dd8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,17 +41,15 @@ def async_setup_entry_base(
class DynaliteBase(RestoreEntity, ABC):
"""Base class for the Dynalite entities."""
_attr_has_entity_name = True
_attr_name = None
def __init__(self, device: Any, bridge: DynaliteBridge) -> None:
"""Initialize the base class."""
self._device = device
self._bridge = bridge
self._unsub_dispatchers: list[Callable[[], None]] = []
@property
def name(self) -> str:
"""Return the name of the entity."""
return self._device.name
@property
def unique_id(self) -> str:
"""Return the unique ID of the entity."""
@ -68,7 +66,7 @@ class DynaliteBase(RestoreEntity, ABC):
return DeviceInfo(
identifiers={(DOMAIN, self._device.unique_id)},
manufacturer="Dynalite",
name=self.name,
name=self._device.name,
)
async def async_added_to_hass(self) -> None: