Przeglądaj źródła

light: don't try to set brightness dp when switching to colour

Condition for setting brightness dp included checking self.raw_color_mode,
but if we were switching to ColorMode it would still apply brightness to
the dp.  In color mode, normally the rgbhsv includes brightness, so this
leads to double brightness, or unexpected mode switching.

Review triggered by discussion #1595
Jason Rumney 2 lat temu
rodzic
commit
a1ba3efec0
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      custom_components/tuya_local/light.py

+ 4 - 1
custom_components/tuya_local/light.py

@@ -352,7 +352,10 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
 
         if (
             ATTR_BRIGHTNESS in params
-            and self.raw_color_mode != ColorMode.HS
+            and (
+                (self.raw_color_mode != ColorMode.HS and color_mode is None)
+                or (color_mode != ColorMode.HS and color_mode is not None)
+            )
             and self._brightness_dps
         ):
             bright = params.get(ATTR_BRIGHTNESS)