Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
a1ba3efec0
1 değiştirilmiş dosya ile 4 ekleme ve 1 silme
  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 (
         if (
             ATTR_BRIGHTNESS in params
             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
             and self._brightness_dps
         ):
         ):
             bright = params.get(ATTR_BRIGHTNESS)
             bright = params.get(ATTR_BRIGHTNESS)