Browse Source

fix (light): consider effect in is_on

If the light is of the type that turns on by effect dp, then this needs to be
checked when checking if the light is on.
Jason Rumney 1 week ago
parent
commit
290a0f8a29
1 changed files with 2 additions and 0 deletions
  1. 2 0
      custom_components/tuya_local/light.py

+ 2 - 0
custom_components/tuya_local/light.py

@@ -139,6 +139,8 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
         elif self._brightness_dps:
             b = self.brightness
             return isinstance(b, int) and b > 0
+        elif self._effect_dps and "off" in self._effect_dps.values(self._device):
+            return self._effect_dps.get_value(self._device) != "off"
         else:
             # There shouldn't be lights without control, but if there are,
             # assume always on if they are responding