Migrate UPB to new entity naming style (#75096)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>pull/74449/head^2
parent
09f37fc522
commit
72906bf154
|
@ -75,11 +75,6 @@ class UpbEntity(Entity):
|
|||
element_type = "link" if element.addr.is_link else "device"
|
||||
self._unique_id = f"{unique_id}_{element_type}_{element.addr}"
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Name of the element."""
|
||||
return self._element.name
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return unique id of the element."""
|
||||
|
|
|
@ -49,6 +49,8 @@ async def async_setup_entry(
|
|||
class UpbLight(UpbAttachedEntity, LightEntity):
|
||||
"""Representation of an UPB Light."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(self, element, unique_id, upb):
|
||||
"""Initialize an UpbLight."""
|
||||
super().__init__(element, unique_id, upb)
|
||||
|
|
|
@ -49,6 +49,11 @@ async def async_setup_entry(
|
|||
class UpbLink(UpbEntity, Scene):
|
||||
"""Representation of an UPB Link."""
|
||||
|
||||
def __init__(self, element, unique_id, upb):
|
||||
"""Initialize the base of all UPB devices."""
|
||||
super().__init__(element, unique_id, upb)
|
||||
self._attr_name = element.name
|
||||
|
||||
async def async_activate(self, **kwargs: Any) -> None:
|
||||
"""Activate the task."""
|
||||
self._element.activate()
|
||||
|
|
Loading…
Reference in New Issue