Pārlūkot izejas kodu

Use brightness to turn on light when there is no other way.

We used to have this feature, but it was lost in some of the refactoring,
I think when a light that did not support turning off was added.

Note though that the light will always come on at full brightness if we
rely on the brightness control to turn on and off.

Should solve the issue mentioned in PR #743
Jason Rumney 2 gadi atpakaļ
vecāks
revīzija
0d28a347af
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  1. 4 0
      custom_components/tuya_local/light.py

+ 4 - 0
custom_components/tuya_local/light.py

@@ -364,6 +364,10 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
                 settings = settings | self._switch_dps.get_values_to_set(
                     self._device, True
                 )
+        elif self._brightness_dps and not self.is_on:
+            settings = settings | self._brightness_dps.get_values_to_set(
+                self._device, 255
+            )
 
         if settings:
             await self._device.async_set_properties(settings)