Просмотр исходного кода

PJ1103: add extra dps, make some optional

Although the report is missing the log, I assume that the attributes without
a value are missing, which includes formerly non-optional Max standby power.

Protect optional scaled values from trying to scale null values by adding an
explicit mapping for null.

Issue #395
Jason Rumney 3 лет назад
Родитель
Сommit
fa9dcfed2e
1 измененных файлов с 45 добавлено и 3 удалено
  1. 45 3
      custom_components/tuya_local/devices/pj1103_clamp_meter.yaml

+ 45 - 3
custom_components/tuya_local/devices/pj1103_clamp_meter.yaml

@@ -13,13 +13,22 @@ primary_entity:
       class: measurement
       class: measurement
       mapping:
       mapping:
         - scale: 10
         - scale: 10
+    - id: 24
+      name: calibration
+      type: integer
+      optional: true
     - id: 52
     - id: 52
       name: maximum
       name: maximum
       type: integer
       type: integer
+      optional: true
     - id: 21
     - id: 21
       type: bitfield
       type: bitfield
       name: test
       name: test
       optional: true
       optional: true
+    - id: 26
+      type: bitfield
+      name: fault_code
+      optional: true
 secondary_entities:
 secondary_entities:
   - entity: sensor
   - entity: sensor
     name: Current
     name: Current
@@ -31,6 +40,10 @@ secondary_entities:
         name: sensor
         name: sensor
         unit: mA
         unit: mA
         class: measurement
         class: measurement
+      - id: 23
+        type: integer
+        name: calibration
+        optional: true
   - entity: sensor
   - entity: sensor
     name: Voltage
     name: Voltage
     class: voltage
     class: voltage
@@ -60,7 +73,36 @@ secondary_entities:
           min: 0
           min: 0
           max: 100
           max: 100
         mapping:
         mapping:
+          - dps_val: null
           - scale: 10
           - scale: 10
-
-
-
+  - entity: sensor
+    name: Energy
+    class: energy
+    category: diagnostic
+    dps:
+      - id: 17
+        type: integer
+        name: sensor
+        optional: true
+        mapping:
+          - dps_val: null
+          - scale: 100
+      - id: 25
+        type: integer
+        name: calibration
+        optional: true
+  - entity: binary_sensor
+    name: Fault
+    class: problem
+    category: diagnostic
+    dps:
+      - id: 26
+        type: bitfield
+        name: sensor
+        optional: true
+        mapping:
+          - dps_val: null
+            value: false
+          - dps_val: 0
+            value: false
+          - value: true