فهرست منبع

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 سال پیش
والد
کامیت
a1ba3efec0
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  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)