From b2c3d959119e1ab8a03bc26782d7ece9a8485063 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker <joostlek@outlook.com> Date: Fri, 8 Sep 2023 11:33:59 +0200 Subject: [PATCH] Use shorthand attributes in UPB (#99892) --- homeassistant/components/upb/light.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/upb/light.py b/homeassistant/components/upb/light.py index 4a71789423f..50e6d50bb4c 100644 --- a/homeassistant/components/upb/light.py +++ b/homeassistant/components/upb/light.py @@ -57,7 +57,7 @@ class UpbLight(UpbAttachedEntity, LightEntity): def __init__(self, element, unique_id, upb): """Initialize an UpbLight.""" super().__init__(element, unique_id, upb) - self._brightness = self._element.status + self._attr_brightness: int = self._element.status @property def color_mode(self) -> ColorMode: @@ -78,15 +78,10 @@ class UpbLight(UpbAttachedEntity, LightEntity): return LightEntityFeature.TRANSITION | LightEntityFeature.FLASH return LightEntityFeature.FLASH - @property - def brightness(self): - """Get the brightness.""" - return self._brightness - @property def is_on(self) -> bool: """Get the current brightness.""" - return self._brightness != 0 + return self._attr_brightness != 0 async def async_turn_on(self, **kwargs: Any) -> None: """Turn on the light.""" @@ -123,4 +118,4 @@ class UpbLight(UpbAttachedEntity, LightEntity): def _element_changed(self, element, changeset): status = self._element.status - self._brightness = round(status * 2.55) if status else 0 + self._attr_brightness = round(status * 2.55) if status else 0 -- GitLab