mirror of
https://github.com/home-assistant/core.git
synced 2025-06-15 10:37:06 +00:00
Migrate Dynalite to has entity name (#96569)
This commit is contained in:
parent
1097bde71b
commit
65db77dd8a
@ -41,17 +41,15 @@ def async_setup_entry_base(
|
|||||||
class DynaliteBase(RestoreEntity, ABC):
|
class DynaliteBase(RestoreEntity, ABC):
|
||||||
"""Base class for the Dynalite entities."""
|
"""Base class for the Dynalite entities."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, device: Any, bridge: DynaliteBridge) -> None:
|
def __init__(self, device: Any, bridge: DynaliteBridge) -> None:
|
||||||
"""Initialize the base class."""
|
"""Initialize the base class."""
|
||||||
self._device = device
|
self._device = device
|
||||||
self._bridge = bridge
|
self._bridge = bridge
|
||||||
self._unsub_dispatchers: list[Callable[[], None]] = []
|
self._unsub_dispatchers: list[Callable[[], None]] = []
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self) -> str:
|
|
||||||
"""Return the name of the entity."""
|
|
||||||
return self._device.name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self) -> str:
|
def unique_id(self) -> str:
|
||||||
"""Return the unique ID of the entity."""
|
"""Return the unique ID of the entity."""
|
||||||
@ -68,7 +66,7 @@ class DynaliteBase(RestoreEntity, ABC):
|
|||||||
return DeviceInfo(
|
return DeviceInfo(
|
||||||
identifiers={(DOMAIN, self._device.unique_id)},
|
identifiers={(DOMAIN, self._device.unique_id)},
|
||||||
manufacturer="Dynalite",
|
manufacturer="Dynalite",
|
||||||
name=self.name,
|
name=self._device.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user