Parcourir la source

PC321-TY: add optional energy produced sensors for each phase

Make all the phase specific sensors hidden by default, except Voltage A,
which does not have an overall equivalent.

Use standard class translations where possible.

Issue #2897
Jason Rumney il y a 1 an
Parent
commit
0cba861d4a
1 fichiers modifiés avec 80 ajouts et 8 suppressions
  1. 80 8
      custom_components/tuya_local/devices/pc321ty_energy_meter.yaml

+ 80 - 8
custom_components/tuya_local/devices/pc321ty_energy_meter.yaml

@@ -41,10 +41,10 @@ entities:
           - scale: 100
           - scale: 100
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
+    class: voltage
     translation_key: voltage_x
     translation_key: voltage_x
     translation_placeholders:
     translation_placeholders:
       x: A
       x: A
-    class: voltage
     dps:
     dps:
       - id: 101
       - id: 101
         name: sensor
         name: sensor
@@ -57,6 +57,7 @@ entities:
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     class: current
     class: current
+    hidden: true
     translation_key: current_x
     translation_key: current_x
     translation_placeholders:
     translation_placeholders:
       x: A
       x: A
@@ -72,6 +73,7 @@ entities:
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     class: power
     class: power
+    hidden: true
     translation_key: power_x
     translation_key: power_x
     translation_placeholders:
     translation_placeholders:
       x: A
       x: A
@@ -85,6 +87,7 @@ entities:
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     class: power_factor
     class: power_factor
+    hidden: true
     name: Power factor A
     name: Power factor A
     dps:
     dps:
       - id: 104
       - id: 104
@@ -95,20 +98,42 @@ entities:
           - scale: 100
           - scale: 100
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
-    name: Energy A
+    class: energy
+    hidden: true
+    translation_key: energy_consumed_x
+    translation_placeholders:
+      x: A
     dps:
     dps:
       - id: 106
       - id: 106
         name: sensor
         name: sensor
         type: integer
         type: integer
         unit: kWh
         unit: kWh
+        class: total_increasing
         mapping:
         mapping:
           - scale: 100
           - scale: 100
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
+    class: energy
+    hidden: true
+    translation_key: energy_produced_x
+    translation_placeholders:
+      x: A
+    dps:
+      - id: 107
+        name: sensor
+        type: integer
+        optional: true
+        unit: kWh
+        class: total_increasing
+        mapping:
+          - scale: 100  
+  - entity: sensor
+    category: diagnostic
+    class: voltage
+    hidden: true
     translation_key: voltage_x
     translation_key: voltage_x
     translation_placeholders:
     translation_placeholders:
       x: B
       x: B
-    class: voltage
     dps:
     dps:
       - id: 111
       - id: 111
         name: sensor
         name: sensor
@@ -121,6 +146,7 @@ entities:
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     class: current
     class: current
+    hidden: true
     translation_key: current_x
     translation_key: current_x
     translation_placeholders:
     translation_placeholders:
       x: B
       x: B
@@ -136,6 +162,7 @@ entities:
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     class: power
     class: power
+    hidden: true
     translation_key: power_x
     translation_key: power_x
     translation_placeholders:
     translation_placeholders:
       x: B
       x: B
@@ -149,6 +176,7 @@ entities:
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     class: power_factor
     class: power_factor
+    hidden: true
     name: Power factor B
     name: Power factor B
     dps:
     dps:
       - id: 114
       - id: 114
@@ -159,20 +187,42 @@ entities:
           - scale: 100
           - scale: 100
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
-    name: Energy B
+    class: energy
+    hidden: true
+    translation_key: energy_consumed_x
+    translation_placeholders:
+      x: B
     dps:
     dps:
       - id: 116
       - id: 116
         name: sensor
         name: sensor
         type: integer
         type: integer
         unit: kWh
         unit: kWh
+        class: total_increasing
         mapping:
         mapping:
           - scale: 100
           - scale: 100
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
+    class: energy
+    hidden: true
+    translation_key: energy_produced_x
+    translation_placeholders:
+      x: B
+    dps:
+      - id: 117
+        name: sensor
+        type: integer
+        optional: true
+        unit: kWh
+        class: total_increasing
+        mapping:
+          - scale: 100  
+  - entity: sensor
+    category: diagnostic
+    class: voltage
+    hidden: true
     translation_key: voltage_x
     translation_key: voltage_x
     translation_placeholders:
     translation_placeholders:
       x: C
       x: C
-    class: voltage
     dps:
     dps:
       - id: 121
       - id: 121
         name: sensor
         name: sensor
@@ -185,6 +235,7 @@ entities:
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     class: current
     class: current
+    hidden: true
     translation_key: current_x
     translation_key: current_x
     translation_placeholders:
     translation_placeholders:
       x: C
       x: C
@@ -200,6 +251,7 @@ entities:
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     class: power
     class: power
+    hidden: true
     translation_key: power_x
     translation_key: power_x
     translation_placeholders:
     translation_placeholders:
       x: C
       x: C
@@ -213,6 +265,7 @@ entities:
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     class: power_factor
     class: power_factor
+    hidden: true
     name: Power factor C
     name: Power factor C
     dps:
     dps:
       - id: 124
       - id: 124
@@ -223,18 +276,38 @@ entities:
           - scale: 100
           - scale: 100
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
-    name: Energy C
+    class: energy
+    hidden: true
+    translation_key: energy_consumed_x
+    translation_placeholders:
+      x: C
     dps:
     dps:
       - id: 126
       - id: 126
         name: sensor
         name: sensor
         type: integer
         type: integer
         unit: kWh
         unit: kWh
+        class: total_increasing
         mapping:
         mapping:
           - scale: 100
           - scale: 100
+  - entity: sensor
+    category: diagnostic
+    class: energy
+    hidden: true
+    translation_key: energy_produced_x
+    translation_placeholders:
+      x: C
+    dps:
+      - id: 127
+        name: sensor
+        type: integer
+        optional: true
+        unit: kWh
+        class: total_increasing
+        mapping:
+          - scale: 100  
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     class: current
     class: current
-    name: Total current
     dps:
     dps:
       - id: 132
       - id: 132
         type: integer
         type: integer
@@ -247,7 +320,6 @@ entities:
   - entity: sensor
   - entity: sensor
     category: diagnostic
     category: diagnostic
     class: power
     class: power
-    name: Total active power
     dps:
     dps:
       - id: 133
       - id: 133
         type: integer
         type: integer