From e833f1dcba7829ffe46730fca482397d6792d4ce Mon Sep 17 00:00:00 2001 From: litinoveweedle <15144712+litinoveweedle@users.noreply.github.com> Date: Fri, 27 Sep 2024 22:46:44 +0200 Subject: [PATCH] fix CodeQL warning unified lights properties --- custom_components/smartir/light.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/custom_components/smartir/light.py b/custom_components/smartir/light.py index 8f783bfa..1f976bf9 100644 --- a/custom_components/smartir/light.py +++ b/custom_components/smartir/light.py @@ -165,6 +165,11 @@ def name(self): """Return the display name of the light.""" return self._name + @property + def state(self): + """Return the current state.""" + return self._state + @property def color_mode(self): # We only support a single color mode currently, so no need to track it @@ -178,15 +183,22 @@ def color_temp_kelvin(self): def min_color_temp_kelvin(self): if self._colortemps: return self._colortemps[0] + else: + return None @property def max_color_temp_kelvin(self): if self._colortemps: return self._colortemps[-1] + else: + return None @property def is_on(self): - return self._state == STATE_ON or self._on_by_remote + if self._state == STATE_ON: + return True + else: + return False @property def brightness(self):