Browse Source

feat(ty12w_relayboard): support variants with 8 to 24 relays

For TY-24W(B) from issue #4700
Jason Rumney 2 months ago
parent
commit
63219d7897
2 changed files with 260 additions and 1 deletions
  1. 1 1
      DEVICES.md
  2. 259 0
      custom_components/tuya_local/devices/ty12w_relayboard.yaml

+ 1 - 1
DEVICES.md

@@ -780,7 +780,7 @@ the best option.
 - Teckin SS42 outdoor double smartplug
 - Tellur 3 outlet + USB power strip with individual timers
 - Tongou TOVTH-216WTTDA temperature humidity sensor dual smart switch
-- TY-12W 12 switch relay board
+- TY-12W/24W 12/24 switch relay boards (boards with 8 - 24 relays supported)
 - WF-WS02 RJ dual switch with master
 - Woox R4028/DIGOO DG-PS01 3 outlet + USB powerstrip with individual timers
 

+ 259 - 0
custom_components/tuya_local/devices/ty12w_relayboard.yaml

@@ -1,4 +1,7 @@
 name: Relay board
+products:
+  - id: 5bk3dyjvxcjk42mm
+    model: TY-24W(B)
 entities:
   - entity: switch
     translation_key: switch_x
@@ -65,6 +68,7 @@ entities:
         name: switch
         type: boolean
   - entity: switch
+    hidden: unavailable
     translation_key: switch_x
     translation_placeholders:
       x: "9"
@@ -72,7 +76,17 @@ entities:
       - id: 103
         name: switch
         type: boolean
+        optional: true
+      - id: 103
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
   - entity: switch
+    hidden: unavailable
     translation_key: switch_x
     translation_placeholders:
       x: "10"
@@ -80,7 +94,17 @@ entities:
       - id: 104
         name: switch
         type: boolean
+        optional: true
+      - id: 104
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
   - entity: switch
+    hidden: unavailable
     translation_key: switch_x
     translation_placeholders:
       x: "11"
@@ -88,7 +112,17 @@ entities:
       - id: 105
         name: switch
         type: boolean
+        optional: true
+      - id: 105
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
   - entity: switch
+    hidden: unavailable
     translation_key: switch_x
     translation_placeholders:
       x: "12"
@@ -96,3 +130,228 @@ entities:
       - id: 106
         name: switch
         type: boolean
+        optional: true
+      - id: 106
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "13"
+    dps:
+      - id: 107
+        name: switch
+        type: boolean
+        optional: true
+      - id: 107
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "14"
+    dps:
+      - id: 108
+        name: switch
+        type: boolean
+        optional: true
+      - id: 108
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "15"
+    dps:
+      - id: 109
+        name: switch
+        type: boolean
+        optional: true
+      - id: 109
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "16"
+    dps:
+      - id: 110
+        name: switch
+        type: boolean
+        optional: true
+      - id: 110
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "17"
+    dps:
+      - id: 111
+        name: switch
+        type: boolean
+        optional: true
+      - id: 111
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "18"
+    dps:
+      - id: 112
+        name: switch
+        type: boolean
+        optional: true
+      - id: 112
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "19"
+    dps:
+      - id: 113
+        name: switch
+        type: boolean
+        optional: true
+      - id: 113
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "20"
+    dps:
+      - id: 114
+        name: switch
+        type: boolean
+        optional: true
+      - id: 114
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "21"
+    dps:
+      - id: 115
+        name: switch
+        type: boolean
+        optional: true
+      - id: 115
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "22"
+    dps:
+      - id: 116
+        name: switch
+        type: boolean
+        optional: true
+      - id: 116
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "23"
+    dps:
+      - id: 117
+        name: switch
+        type: boolean
+        optional: true
+      - id: 117
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true
+  - entity: switch
+    hidden: unavailable
+    translation_key: switch_x
+    translation_placeholders:
+      x: "24"
+    dps:
+      - id: 118
+        name: switch
+        type: boolean
+        optional: true
+      - id: 118
+        name: available
+        type: boolean
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - value: true