瀏覽代碼

fix (light): don't override switch if it is already indirectly set

If a light reuses the switch dp as another setting, it can already be set
in async_turn_on before we process the switch dp. This means the setting
gets overridden by the default "on" value, despite turn_on was called
with an argument that might be setting it to a different value.

Example: a light has a single dp with "off", "warm", "cold". It is set
with "cold" as the default on value, but the user wants to turn it on
as warm so gives the 2700K color_temp as a parameter to turn_on.

PR #4398
Jason Rumney 3 月之前
父節點
當前提交
d4f835b66e
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      custom_components/tuya_local/light.py

+ 1 - 1
custom_components/tuya_local/light.py

@@ -480,7 +480,7 @@ class TuyaLocalLight(TuyaLocalEntity, LightEntity):
                     ),
                 }
 
-        if self._switch_dps and not self.is_on:
+        if self._switch_dps and not self.is_on and self._switch_dps.id not in settings:
             if (
                 self._switch_dps.readonly
                 and self._effect_dps