瀏覽代碼

Asakuki diffuser: add named_color support

The light on this device had the color disabled due to the format being
inconsistent, and replaced by a separate select entity.

The problem is this made the light white-only from HA point of view,
which should have used a different color mode.

Since HA is breaking backward compatibility with lights that use the color modes
incorrectly in 2025.3, this needs to be fixed by either changing to the
appropriate "brightness" mode instead of "white", or by adding color support
back in. Because we added named color support in the meantime, we are able
to do the latter.

Issue #2807
Jason Rumney 1 年之前
父節點
當前提交
efa15e4c7e
共有 1 個文件被更改,包括 56 次插入34 次删除
  1. 56 34
      custom_components/tuya_local/devices/asakuki_diffuser.yaml

+ 56 - 34
custom_components/tuya_local/devices/asakuki_diffuser.yaml

@@ -30,7 +30,7 @@ entities:
           - dps_val: white
             value: white
           - dps_val: colour
-            value: Color
+            value: hs
           - dps_val: colourfull
             value: Mood
       - id: 111
@@ -40,39 +40,60 @@ entities:
           min: 0
           max: 255
       - id: 108
-        name: color_data
-        type: hex
-        format:
-          - name: r
-            bytes: 1
-            range:
-              min: 0
-              max: 255
-          - name: g
-            bytes: 1
-            range:
-              min: 0
-              max: 255
-          - name: b
-            bytes: 1
-            range:
-              min: 0
-              max: 255
-          - name: h
-            bytes: 2
-            range:
-              min: 0
-              max: 360
-          - name: s
-            bytes: 1
-            range:
-              min: 0
-              max: 100
-          - name: v
-            bytes: 1
-            range:
-              min: 0
-              max: 255
+        name: named_color
+        type: string
+        mapping:
+          - dps_val: "ff00000064ff"
+            value: red
+          - dps_val: "ffa5002764ff"
+            value: orange
+          - dps_val: "ffff003c64ff"
+            value: yellow
+          - dps_val: "008000786480"
+            value: green
+          - dps_val: "0000fff064ff"
+            value: blue
+          - dps_val: "4b008201136482"
+            value: indigo
+          - dps_val: "ee82ee012c2dee"
+            value: violet
+          - dps_val: "00ff007864ff"
+            value: lime
+          - dps_val: "ffc0cb015e19ff"
+            value: pink
+          - dps_val: "00ffff8464ff"
+            value: cyan
+        # type: hex
+        #   - name: r
+        #     bytes: 1
+        #     range:
+        #       min: 0
+        #       max: 255
+        #   - name: g
+        #     bytes: 1
+        #     range:
+        #       min: 0
+        #       max: 255
+        #   - name: b
+        #     bytes: 1
+        #     range:
+        #       min: 0
+        #       max: 255
+        #   - name: h
+        #     bytes: 2  # format inconsistent, uses 1 byte when leading byte is 0
+        #     range:
+        #       min: 0
+        #       max: 360
+        #   - name: s
+        #     bytes: 1
+        #     range:
+        #       min: 0
+        #       max: 100
+        #   - name: v
+        #     bytes: 1
+        #     range:
+        #       min: 0
+        #       max: 255
   - entity: select
     name: Mood
     icon: "mdi:palette"
@@ -90,6 +111,7 @@ entities:
             value: Mood 3
   - entity: select
     name: Color
+    deprecated: light
     icon: "mdi:palette"
     category: config
     dps: