Преглед изворни кода

Add IMAGINE 3+1 WiFi Switch device config (#5562)

* Add IMAGINE 3+1 WiFi Switch device config

Adds support for the IMAGINE 3+1 WiFi Switch (model IT31LFW, product_id haqyilpinwntqgzj) - a 3-gang switchboard with an integrated fan speed regulator.

Dp mapping confirmed from live diagnostics:
- 1,2,3: switch relays
- 9,10,11: per-switch auto-off timers (seconds)
- 101: fan power
- 102: fan speed (string enum off/level_1..level_4, mapped to 0/25/50/75/100)
- 103: fan auto-off timer (seconds)

* Address review: drop redundant products.name, cap timers at 86399

* Refactor translation placeholders to multiline format

Updated translation placeholders for switch and timer entities to use multiline format.

---------

Co-authored-by: Jason Rumney <make-all@users.noreply.github.com>
Gurmeher Chawla пре 5 дана
родитељ
комит
f03aa4c6e6
1 измењених фајлова са 111 додато и 0 уклоњено
  1. 111 0
      custom_components/tuya_local/devices/imagine_it31lfw_switchfan.yaml

+ 111 - 0
custom_components/tuya_local/devices/imagine_it31lfw_switchfan.yaml

@@ -0,0 +1,111 @@
+name: Switchboard with fan
+products:
+  - id: haqyilpinwntqgzj
+    manufacturer: Imagine
+    model: IT31LFW
+
+# Built from real diagnostics dump:
+#   1,2,3   = switch relays (boolean)
+#   9,10,11 = per-switch auto-off timers, seconds (paired with 1,2,3)
+#   101     = fan power (boolean)
+#   102     = fan speed, string enum: off/level_1/level_2/level_3/level_4
+#   103     = fan auto-off timer, seconds
+
+entities:
+  - entity: switch
+    translation_key: switch_x
+    translation_placeholders:
+      x: "1"
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
+
+  - entity: switch
+    translation_key: switch_x
+    translation_placeholders:
+      x: "2"
+    dps:
+      - id: 2
+        type: boolean
+        name: switch
+
+  - entity: switch
+    translation_key: switch_x
+    translation_placeholders:
+      x: "3"
+    dps:
+      - id: 3
+        type: boolean
+        name: switch
+
+  - entity: fan
+    dps:
+      - id: 101
+        type: boolean
+        name: switch
+      - id: 102
+        type: string
+        name: speed
+        mapping:
+          - dps_val: "off"
+            value: 0
+          - dps_val: level_1
+            value: 25
+          - dps_val: level_2
+            value: 50
+          - dps_val: level_3
+            value: 75
+          - dps_val: level_4
+            value: 100
+
+  # --- Optional: auto-off timers, one per switch/fan ---
+  - entity: time
+    category: config
+    translation_key: timer_x
+    translation_placeholders:
+      x: "1"
+    dps:
+      - id: 9
+        type: integer
+        name: second
+        range:
+          min: 0
+          max: 86399
+
+  - entity: time
+    category: config
+    translation_key: timer_x
+    translation_placeholders:
+      x: "2"
+    dps:
+      - id: 10
+        type: integer
+        name: second
+        range:
+          min: 0
+          max: 86399
+
+  - entity: time
+    category: config
+    translation_key: timer_x
+    translation_placeholders:
+      x: "3"
+    dps:
+      - id: 11
+        type: integer
+        name: second
+        range:
+          min: 0
+          max: 86399
+
+  - entity: time
+    category: config
+    name: Fan timer
+    dps:
+      - id: 103
+        type: integer
+        name: second
+        range:
+          min: 0
+          max: 86399