소스 검색

fix(goldair_portable_airconditioner): use swing_mode when only one

When a device has only horizontal swing mode (seems usual for portable
air conditioners), redirect it to swing_mode, as HA expects swing_mode
to be supported primarily, so does not really support devices with only
swing_horizontal_mode.

This reverts an earlier change that swapped vertical and horizontal swing
modes, which was probably incorrect, as the documentation for goldair
clearly says dp 15 should be vertical swing.

Issue #3496
Jason Rumney 7 달 전
부모
커밋
5ad0857b01
1개의 변경된 파일53개의 추가작업 그리고 10개의 파일을 삭제
  1. 53 10
      custom_components/tuya_local/devices/goldair_portable_airconditioner.yaml

+ 53 - 10
custom_components/tuya_local/devices/goldair_portable_airconditioner.yaml

@@ -67,14 +67,20 @@ entities:
             value: high
       - id: 15
         type: string
-        name: swing_horizontal_mode
+        name: swing_mode
         mapping:
-          - dps_val: "on"
-            value: "on"
-            available: support_hswing
-          - dps_val: "off"
-            value: "off"
-            available: support_hswing
+          - constraint: support_only_hswing
+            conditions:
+              - dps_val: true
+                value_redirect: swing_real_horizontal_mode
+              - dps_val: false
+                mapping:
+                  - dps_val: "on"
+                    value: "on"
+                    available: support_swing
+                  - dps_val: "off"
+                    value: "off"
+                    available: support_swing
       - id: 107
         type: integer
         optional: true
@@ -105,6 +111,27 @@ entities:
           - dps_val: 2
             value: true
           - value: false
+      - id: 109
+        type: bitfield
+        name: support_only_hswing
+        mapping:
+          - dps_val: 1
+            value: false
+          - value_redirect: support_hswing
+      - id: 109
+        type: bitfield
+        name: support_swing
+        mapping:
+          - dps_val: 1
+            value: true
+          - value: redirect: support_hswing
+      - id: 109
+        type: bitfield
+        name: support_both_swing
+        mapping:
+          - dps_val: 1
+            value_redirect: support_hswing
+          - value: false
       - id: 109
         type: bitfield
         name: support_heat
@@ -128,14 +155,30 @@ entities:
           - value: C
       - id: 110
         type: boolean
-        name: swing_mode
+        name: swing_horizontal_mode
+        mapping:
+          - constraint: support_only_hswing
+            conditions:
+              - dps_val: true
+                value: null
+              - dps_val: false
+                mapping:
+                  - dps_val: true
+                    value: "on"
+                    available: support_both_swing
+                  - dps_val: false
+                    value: "off"
+                    available: support_both_swing
+      - id: 10
+        type: boolean
+        name: swing_real_horizontal_mode
         mapping:
           - dps_val: true
             value: "on"
-            available: support_vswing
+            available: support_hswing
           - dps_val: false
             value: "off"
-            available: support_vswing
+            available: support_hswing
   - entity: switch
     translation_key: ionizer
     hidden: unavailable