mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Migrate UPB to new entity naming style (#75096)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
09f37fc522
commit
72906bf154
@ -75,11 +75,6 @@ class UpbEntity(Entity):
|
|||||||
element_type = "link" if element.addr.is_link else "device"
|
element_type = "link" if element.addr.is_link else "device"
|
||||||
self._unique_id = f"{unique_id}_{element_type}_{element.addr}"
|
self._unique_id = f"{unique_id}_{element_type}_{element.addr}"
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Name of the element."""
|
|
||||||
return self._element.name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
"""Return unique id of the element."""
|
"""Return unique id of the element."""
|
||||||
|
@ -49,6 +49,8 @@ async def async_setup_entry(
|
|||||||
class UpbLight(UpbAttachedEntity, LightEntity):
|
class UpbLight(UpbAttachedEntity, LightEntity):
|
||||||
"""Representation of an UPB Light."""
|
"""Representation of an UPB Light."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(self, element, unique_id, upb):
|
def __init__(self, element, unique_id, upb):
|
||||||
"""Initialize an UpbLight."""
|
"""Initialize an UpbLight."""
|
||||||
super().__init__(element, unique_id, upb)
|
super().__init__(element, unique_id, upb)
|
||||||
|
@ -49,6 +49,11 @@ async def async_setup_entry(
|
|||||||
class UpbLink(UpbEntity, Scene):
|
class UpbLink(UpbEntity, Scene):
|
||||||
"""Representation of an UPB Link."""
|
"""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:
|
async def async_activate(self, **kwargs: Any) -> None:
|
||||||
"""Activate the task."""
|
"""Activate the task."""
|
||||||
self._element.activate()
|
self._element.activate()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user