From 65db77dd8ad1acd8f1b70f08e8fa6fd85c74b566 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Tue, 18 Jul 2023 09:58:42 +0200 Subject: [PATCH] Migrate Dynalite to has entity name (#96569) --- homeassistant/components/dynalite/dynalitebase.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/dynalite/dynalitebase.py b/homeassistant/components/dynalite/dynalitebase.py index 3ebf04ab219..85c672e0f64 100644 --- a/homeassistant/components/dynalite/dynalitebase.py +++ b/homeassistant/components/dynalite/dynalitebase.py @@ -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: