mirror of
https://github.com/Andre0512/hon.git
synced 2025-05-18 17:14:26 -04:00
Refactor hon entities
This commit is contained in:
parent
696dc136eb
commit
a8762367ed
8 changed files with 382 additions and 369 deletions
|
@ -14,7 +14,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
class HonEntity(CoordinatorEntity):
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(self, hass, entry, device: HonAppliance) -> None:
|
||||
def __init__(self, hass, entry, device: HonAppliance, description=None) -> None:
|
||||
coordinator = get_coordinator(hass, device)
|
||||
super().__init__(coordinator)
|
||||
|
||||
|
@ -23,7 +23,11 @@ class HonEntity(CoordinatorEntity):
|
|||
self._coordinator = coordinator
|
||||
self._device = device
|
||||
|
||||
self._attr_unique_id = self._device.unique_id
|
||||
if description is not None:
|
||||
self.entity_description = description
|
||||
self._attr_unique_id = f"{self._device.unique_id}{description.key}"
|
||||
else:
|
||||
self._attr_unique_id = self._device.unique_id
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue