Browse Source

feat (matsee_2way_energymeter): scale power and current according to direction

When direction is REVERSE, scale them negative so the sign is correct for
power flow diagrams.

Issue #4833 (info on values from original #1072)
Jason Rumney 5 days ago
parent
commit
71e2760350
1 changed files with 24 additions and 0 deletions
  1. 24 0
      custom_components/tuya_local/devices/matsee_2way_energymeter.yaml

+ 24 - 0
custom_components/tuya_local/devices/matsee_2way_energymeter.yaml

@@ -68,6 +68,10 @@ entities:
         class: measurement
         mapping:
           - scale: 10
+            constraint: direction
+            conditions:
+              - dps_val: REVERSE
+                scale: -10
       - id: 102
         type: string
         optional: true
@@ -91,6 +95,10 @@ entities:
         class: measurement
         mapping:
           - scale: 10
+            constraint: direction
+            conditions:
+              - dps_val: REVERSE
+                scale: -10
       - id: 104
         type: string
         optional: true
@@ -232,6 +240,14 @@ entities:
         class: measurement
         mapping:
           - scale: 1000
+            constraint: direction
+            conditions:
+              - dps_val: REVERSE
+                scale: -1000
+      - id: 102
+        type: string
+        optional: true
+        name: direction
       - id: 117
         type: integer
         name: calibration
@@ -251,6 +267,14 @@ entities:
         class: measurement
         mapping:
           - scale: 1000
+            constraint: direction
+            conditions:
+              - dps_val: REVERSE
+                scale: -1000
+      - id: 104
+        type: string
+        optional: true
+        name: direction
       - id: 123
         type: integer
         name: calibration