소스 검색

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)