4
0
Эх сурвалжийг харах

refactor: consolidate and update newly added configs

- update to use current schema
- merge 2gang and 4gang switches into a single config
- use translations where possible

PR #3345
Jason Rumney 7 сар өмнө
parent
commit
e89202c8a5

+ 0 - 75
custom_components/tuya_local/devices/homemate_2gang_switch.yaml

@@ -1,75 +0,0 @@
-name: HomeMate 2Gang Switch
-products:
-  - id: jbaaqtkiuyjyuwtq
-    name: HomeMate 2Gang Switch
-primary_entity:
-  entity: switch
-  name: Switch 1
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-secondary_entities:
-  - entity: switch
-    name: Switch 2
-    dps:
-      - id: 2
-        name: switch
-        type: boolean
-  - entity: switch
-    icon: "mdi:toggle-switch"
-    name: MasterSwitch
-    dps:
-      - id: 13
-        type: boolean
-        name: switch
-  - entity: number
-    category: config
-    icon: "mdi:timer"
-    name: Countdown_1
-    dps:
-      - id: 7
-        type: integer
-        name: value
-        unit: min
-        optional: true
-        range:
-          min: 0
-          max: 86400
-        mapping:
-          - scale: 60
-            step: 60
-  - entity: number
-    category: config
-    icon: "mdi:timer"
-    name: Countdown_2
-    dps:
-      - id: 8
-        type: integer
-        name: value
-        unit: min
-        optional: true
-        range:
-          min: 0
-          max: 86400
-        mapping:
-          - scale: 60
-            step: 60
-  - entity: select
-    name: Power on state
-    icon: "mdi:toggle-switch"
-    category: config
-    dps:
-      - id: 14
-        type: string
-        name: option
-        optional: true
-        mapping:
-          - dps_val: "off"
-            value: "Power Off"
-          - dps_val: "on"
-            value: "Power On"
-          - dps_val: "memory"
-            value: "Last state"
-          - dps_val: null
-            invalid: true

+ 0 - 119
custom_components/tuya_local/devices/homemate_4gang_switch.yaml

@@ -1,119 +0,0 @@
-name: HomeMate 4Gang Switch
-products:
-  - id: ai2cizw27dqsamlr
-    name: HomeMate 4Gang Switch
-primary_entity:
-  entity: switch
-  name: Switch 1
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-secondary_entities:
-  - entity: switch
-    name: Switch 2
-    dps:
-      - id: 2
-        name: switch
-        type: boolean
-  - entity: switch
-    name: Switch 3
-    dps:
-      - id: 3
-        name: switch
-        type: boolean
-  - entity: switch
-    name: Switch 4
-    dps:
-      - id: 4
-        name: switch
-        type: boolean
-  - entity: switch
-    icon: "mdi:toggle-switch"
-    name: MasterSwitch
-    dps:
-      - id: 13
-        type: boolean
-        name: switch
-  - entity: number
-    category: config
-    icon: "mdi:timer"
-    name: Countdown_1
-    dps:
-      - id: 7
-        type: integer
-        name: value
-        unit: min
-        optional: true
-        range:
-          min: 0
-          max: 86400
-        mapping:
-          - scale: 60
-            step: 60
-  - entity: number
-    category: config
-    icon: "mdi:timer"
-    name: Countdown_2
-    dps:
-      - id: 8
-        type: integer
-        name: value
-        unit: min
-        optional: true
-        range:
-          min: 0
-          max: 86400
-        mapping:
-          - scale: 60
-            step: 60
-  - entity: number
-    category: config
-    icon: "mdi:timer"
-    name: Countdown_3
-    dps:
-      - id: 9
-        type: integer
-        name: value
-        unit: min
-        optional: true
-        range:
-          min: 0
-          max: 86400
-        mapping:
-          - scale: 60
-            step: 60
-  - entity: number
-    category: config
-    icon: "mdi:timer"
-    name: Countdown_4
-    dps:
-      - id: 10
-        type: integer
-        name: value
-        unit: min
-        optional: true
-        range:
-          min: 0
-          max: 86400
-        mapping:
-          - scale: 60
-            step: 60
-  - entity: select
-    name: Power on state
-    icon: "mdi:toggle-switch"
-    category: config
-    dps:
-      - id: 14
-        type: string
-        name: option
-        optional: true
-        mapping:
-          - dps_val: "off"
-            value: "Power Off"
-          - dps_val: "on"
-            value: "Power On"
-          - dps_val: "memory"
-            value: "Last state"
-          - dps_val: null
-            invalid: true

+ 16 - 19
custom_components/tuya_local/devices/homemate_fan_regulator.yaml

@@ -1,25 +1,22 @@
-name: HomeMate Fan Regulator
+name: Fan
 products:
 products:
   - id: ewdmma4uccqydpmj
   - id: ewdmma4uccqydpmj
-    name: HomeMate Fan Regulator
-primary_entity:
-  entity: fan
-  dps:
-    - id: 1
-      name: switch
-      type: boolean
-    - id: 3
-      name: speed
-      type: integer
-      range:
-        min: 1
-        max: 5
-      # mapping:
-      #   - scale: 0.05
-secondary_entities:
+    manufacturer: HomeMate
+    model: Fan Regulator
+entities:
+  - entity: fan
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+      - id: 3
+        name: speed
+        type: integer
+        range:
+          min: 1
+          max: 5
   - entity: lock
   - entity: lock
-    name: Child Lock
-    icon: "mdi:hand-back-right-off"
+    translation_key: child_lock
     category: config
     category: config
     dps:
     dps:
       - id: 14
       - id: 14

+ 173 - 0
custom_components/tuya_local/devices/homemate_multi_switch.yaml

@@ -0,0 +1,173 @@
+name: Multi Switch
+products:
+  - id: ai2cizw27dqsamlr
+    manufacturer: HomeMate
+    model: 4Gang Switch
+  - id: jbaaqtkiuyjyuwtq
+    manufacturer: HomeMate
+    model: 2Gang Switch
+entities:
+  - entity: switch
+    translation_key: switch_x
+    translation_placeholders:
+      x: 1
+    dps:
+      - id: 1
+        name: switch
+        type: boolean
+  - entity: switch
+    translation_key: switch_x
+    translation_placeholders:
+      x: 2
+    dps:
+      - id: 2
+        name: switch
+        type: boolean
+  - entity: switch
+    translation_key: switch_x
+    translation_placeholders:
+      x: 3
+    hidden: unavailable
+    dps:
+      - id: 3
+        name: switch
+        type: boolean
+        optional: true
+      - id: 3
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    translation_key: switch_x
+    translation_placeholders:
+      x: 4
+    hidden: unavailable
+    dps:
+      - id: 4
+        name: switch
+        type: boolean
+        optional: true
+      - id: 4
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    icon: "mdi:toggle-switch"
+    name: Main switch
+    dps:
+      - id: 13
+        type: boolean
+        name: switch
+  - entity: number
+    category: config
+    class: duration
+    translation_key: timer_x
+    translation_placeholders:
+      x: 1
+    dps:
+      - id: 7
+        type: integer
+        name: value
+        unit: min
+        optional: true
+        range:
+          min: 0
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
+  - entity: number
+    category: config
+    class: duration
+    translation_key: timer_x
+    translation_placeholders:
+      x: 2
+    dps:
+      - id: 8
+        type: integer
+        name: value
+        unit: min
+        optional: true
+        range:
+          min: 0
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
+  - entity: number
+    category: config
+    class: duration
+    translation_key: timer_x
+    translation_placeholders:
+      x: 3
+    hidden: unavailable
+    dps:
+      - id: 9
+        type: integer
+        name: value
+        unit: min
+        optional: true
+        range:
+          min: 0
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
+      - id: 3
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: number
+    category: config
+    class: duration
+    translation_key: timer_x
+    translation_placeholders:
+      x: 4
+    hidden: unavailable
+    dps:
+      - id: 10
+        type: integer
+        name: value
+        unit: min
+        optional: true
+        range:
+          min: 0
+          max: 86400
+        mapping:
+          - scale: 60
+            step: 60
+      - id: 4
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: select
+    translation_key: initial_state
+    category: config
+    dps:
+      - id: 14
+        type: string
+        name: option
+        optional: true
+        mapping:
+          - dps_val: "off"
+            value: "off"
+          - dps_val: "on"
+            value: "on"
+          - dps_val: "memory"
+            value: "memory"

+ 7 - 8
custom_components/tuya_local/devices/tomzn_energy_meter.yaml

@@ -1,14 +1,13 @@
 name: Energy meter
 name: Energy meter
 products:
 products:
   - id: sw9asyjj8j44frjl
   - id: sw9asyjj8j44frjl
-    name: Tomzn Energy Meter
-primary_entity:
-  entity: switch
-  dps:
-    - id: 1
-      type: boolean
-      name: switch
-secondary_entities:
+    manufacturer: Tomzn
+entities:
+  - entity: switch
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
   - entity: sensor
   - entity: sensor
     class: current
     class: current
     category: diagnostic
     category: diagnostic