Explorar el Código

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 hace 2 años
padre
commit
a1ba3efec0
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  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)