From 72906bf1547b48f2f81aafd418c1c8880046d649 Mon Sep 17 00:00:00 2001 From: Glenn Waters Date: Thu, 14 Jul 2022 15:56:36 -0400 Subject: [PATCH] Migrate UPB to new entity naming style (#75096) Co-authored-by: Franck Nijhof --- homeassistant/components/upb/__init__.py | 5 ----- homeassistant/components/upb/light.py | 2 ++ homeassistant/components/upb/scene.py | 5 +++++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/upb/__init__.py b/homeassistant/components/upb/__init__.py index b2980ace4e1..5e03df71750 100644 --- a/homeassistant/components/upb/__init__.py +++ b/homeassistant/components/upb/__init__.py @@ -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.""" diff --git a/homeassistant/components/upb/light.py b/homeassistant/components/upb/light.py index 13f680d9e5a..98a775c18ab 100644 --- a/homeassistant/components/upb/light.py +++ b/homeassistant/components/upb/light.py @@ -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) diff --git a/homeassistant/components/upb/scene.py b/homeassistant/components/upb/scene.py index 2334e87aeaa..fe6f07199c4 100644 --- a/homeassistant/components/upb/scene.py +++ b/homeassistant/components/upb/scene.py @@ -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()