Просмотр исходного кода

Fairy lights: separate scenes into a select entity.

Scenes require color_mode to be set to "scene", but if we add an "effect" dp,
extra values from color_mode are not selectable as effects.

Instead of putting scene as effect, separate it into its own select entity and
let the additional color_mode show through as effects.

Add the timer as a number entity instead of just an attribute.  It seems
an entity with only optional dps still works.

Issue #309
Jason Rumney 3 лет назад
Родитель
Сommit
7fe5973195
1 измененных файлов с 53 добавлено и 36 удалено
  1. 53 36
      custom_components/tuya_local/devices/light_string.yaml

+ 53 - 36
custom_components/tuya_local/devices/light_string.yaml

@@ -34,43 +34,44 @@ primary_entity:
           range:
             min: 0
             max: 1000
-    - id: 25
-      type: hex
-      name: effect
-      mapping:
-        - dps_val: "0103e8"
-          name: Palm
-        - dps_val: "0101f1"
-          name: "Palm 50%"
-        - dps_val: "0203e8"
-          name: Christmas tree
-        - dps_val: "0201f1"
-          name: "Christmas tree 50%"
-        - dps_val: "0303e8"
-          name: Fence
-        - dps_val: "0301f1"
-          name: "Fence 50%"
-        - dps_val: "0403e8"
-          name: Rainbow
-        - dps_val: "0401f1"
-          name: "Rainbox 50%"
-        - dps_val: "0503e8"
-          name: Photos
-        - dps_val: "0501f1"
-          name: "Photos 50%"
-        - dps_val: "0603e8"
-          name: Fairy lights
-        - dps_val: "0601f1"
-          name: "Fairy lights 50%"
-        - dps_val: "0703e8"
-          name: Wreath
-        - dps_val: "0701f1"
-          name: "Wreath 50%"
-    - id: 26
-      type: integer
-      name: timer
-      optional: true
 secondary_entities:
+  - entity: select
+    name: Scene
+    icon: "mdi:palette"
+    category: config
+    dps:
+      - id: 25
+        type: hex
+        name: option
+        mapping:
+          - dps_val: "0103e8"
+            name: Palm
+          - dps_val: "0101f1"
+            name: "Palm 50%"
+          - dps_val: "0203e8"
+            name: Christmas tree
+          - dps_val: "0201f1"
+            name: "Christmas tree 50%"
+          - dps_val: "0303e8"
+            name: Fence
+          - dps_val: "0301f1"
+            name: "Fence 50%"
+          - dps_val: "0403e8"
+            name: Rainbow
+          - dps_val: "0401f1"
+            name: "Rainbox 50%"
+          - dps_val: "0503e8"
+            name: Photos
+          - dps_val: "0501f1"
+            name: "Photos 50%"
+          - dps_val: "0603e8"
+            name: Fairy lights
+          - dps_val: "0601f1"
+            name: "Fairy lights 50%"
+          - dps_val: "0703e8"
+            name: Wreath
+          - dps_val: "0701f1"
+            name: "Wreath 50%"
   - entity: select
     name: Music mode
     category: config
@@ -88,3 +89,19 @@ secondary_entities:
             value: Spectrum
           - dps_val: 46401bb1006e03e801f4
             value: Rolling
+  - entity: number
+    name: Timer
+    category: config
+    icon: "mdi:timer"
+    dps:
+      - id: 26
+        type: integer
+        name: value
+        optional: true
+        range:
+          min: 0
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
+        unit: min