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

fix(loonas_curtain): do not invert direction when reverse is set

Not sure if this behaviour is universal with Tuya covers, but at least on
the device in #5486, when set to reverse, the positions are inverted when
reported by the device itself (so match the HA expectation without inverting)
Jason Rumney пре 1 недеља
родитељ
комит
dcf18a6864
1 измењених фајлова са 17 додато и 2 уклоњено
  1. 17 2
      custom_components/tuya_local/devices/loonas_curtain.yaml

+ 17 - 2
custom_components/tuya_local/devices/loonas_curtain.yaml

@@ -42,7 +42,12 @@ entities:
           min: 0
           min: 0
           max: 100
           max: 100
         mapping:
         mapping:
-          - invert: true
+          - constraint: direction
+            conditions:
+              - dps_val: null
+                invert: true
+              - dps_val: forward
+                invert: true
       - id: 3
       - id: 3
         name: current_position
         name: current_position
         type: integer
         type: integer
@@ -51,7 +56,17 @@ entities:
           min: 0
           min: 0
           max: 100
           max: 100
         mapping:
         mapping:
-          - invert: true
+          - constraint: direction
+            conditions:
+              - dps_val: null
+                invert: true
+              - dps_val: forward
+                invert: true
+      - id: 5
+        type: string
+        optional: true
+        name: direction
+        hidden: true  # exposed as switch below
       - id: 7
       - id: 7
         name: work_state
         name: work_state
         type: string
         type: string