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

PG103/107: restore binary sensors for battery and power

Although previous comment on #1059 suggested that these act more as events,
and do not correctly reset when the power or battery is restored, based
on new information on #3272 they appear to be indicating that the alarm is
sounding for these events, and will correctly reset when the alarm is stopped.

Therefore they are useful as state sensors to check if the alarm is sounding.
Jason Rumney 9 месяцев назад
Родитель
Сommit
7fbb725245
1 измененных файлов с 26 добавлено и 2 удалено
  1. 26 2
      custom_components/tuya_local/devices/gautone_pg103_alarm.yaml

+ 26 - 2
custom_components/tuya_local/devices/gautone_pg103_alarm.yaml

@@ -112,15 +112,15 @@ entities:
         type: string
         type: string
         name: sensor
         name: sensor
         mapping:
         mapping:
-          - dps_val: normal
-            value: false
           - dps_val: alarm
           - dps_val: alarm
             value: true
             value: true
+          - value: false
   - entity: event
   - entity: event
     name: Alarm
     name: Alarm
     dps:
     dps:
       - id: 26
       - id: 26
         type: string
         type: string
+        optional: true
         name: event
         name: event
         mapping:
         mapping:
           - dps_val: null
           - dps_val: null
@@ -138,8 +138,32 @@ entities:
         type: string
         type: string
         optional: true
         optional: true
         name: sub_state
         name: sub_state
+  - entity: binary_sensor
+    class: battery
+    category: diagnostic
+    dps:
+      - id: 101
+        type: string
+        optional: true
+        name: sensor
+        mapping:
+          - dps_val: low_battery
+            value: true
+          - value: false
+  - entity: binary_sensor
+    class: power
+    category: diagnostic
+    dps:
+      - id: 101
+        type: boolean
+        name: sensor
+        mapping:
+          - dps_val: powerDisconnect
+            value: false
+          - value: true
   - entity: event
   - entity: event
     name: Power
     name: Power
+    deprecated: binary_sensors for battery and power
     dps:
     dps:
       - id: 101
       - id: 101
         type: string
         type: string