Prechádzať zdrojové kódy

fix(pc473_3phase_monitor): changes from #3612

Based on Query Things Data Model info on #3612:
  - added problem and initial_state entities
    mapping for initial state based on other devices using numeric mapping
  - dp 123 is not power, but device status, and another numeric string with unknown value mappings.

Otherwise, this PR was much closer to the Query Things Data Model result than PR #3612, so it will be this one that gets fixed up and integrated.
PR #3583
Jason Rumney 6 mesiacov pred
rodič
commit
fac6a5c2a8

+ 44 - 8
custom_components/tuya_local/devices/pc473_3phase_monitor.yaml

@@ -9,7 +9,39 @@ entities:
       - id: 1
         type: boolean
         name: switch
-
+  - entity: binary_sensor
+    class: problem
+    category: diagnostic
+    dps:
+      - id: 26
+        type: bitfield
+        optional: true
+        name: sensor
+        mapping:
+          - dps_val: 0
+            value: false
+          - dps_val: null
+            value: false
+          - value: true
+      - id: 26
+        type: bitfield
+        optional: true
+        name: fault_code
+  - entity: select
+    translation_key: initial_state
+    category: config
+    dps:
+      - id: 38
+        type: string
+        optional: true
+        name: option
+        mapping:
+          - dps_val: "0"
+            value: "off"
+          - dps_val: "1"
+            value: "on"
+          - dps_val: "2"
+            value: memory
   - entity: sensor
     category: diagnostic
     class: voltage
@@ -335,17 +367,21 @@ entities:
 
   - entity: sensor
     category: diagnostic
-    class: power
-    name: Power generation
+    class: enum
+    translation_key: status
     dps:
       - id: 123
-        type: integer
+        type: string
         name: sensor
-        unit: kW
-        class: measurement
         mapping:
-          - scale: 100
-
+          - dps_val: "0"
+            value: "unknown_0"
+          - dps_val: "1"
+            value: "unknown_1"
+          - dps_val: "2"
+            value: "unknown_2"
+          - dps_val: "3"
+            value: "unknown_3"
   - entity: sensor
     translation_key: energy_produced
     class: energy