Преглед изворни кода

ZX-DB11 doorbells: correct ringing type, add attribute to read it

- ZX-DB11 and ZX-DB11B appear to be essentially the same and should
  probably be merged.
- the original report included base64 (raw) type for alarm, but it was
  missed when adding the device, and later when requested it was
  mistakenly made a boolean. Since this is optional, and only appears
  when actually ringing, this was not detected, and the mapping covers
  the issue.  Later a user submitted a PR for the DB11B which copied
  this mistake.

Based on PR #1761
Jason Rumney пре 1 година
родитељ
комит
0ae409a3a0

+ 7 - 2
custom_components/tuya_local/devices/zx_db11_doorbell_alarm.yaml

@@ -253,7 +253,6 @@ secondary_entities:
         unit: "%"
         class: measurement
   - entity: binary_sensor
-    name: Battery low
     class: battery
     category: diagnostic
     dps:
@@ -271,7 +270,7 @@ secondary_entities:
     category: diagnostic
     dps:
       - id: 26
-        type: boolean
+        type: string
         name: sensor
         optional: true
         persist: false
@@ -279,6 +278,11 @@ secondary_entities:
           - dps_val: null
             value: false
           - value: true
+      - id: 26
+        type: string
+        name: alarm_msg
+        optional: true
+        persist: false
   - entity: switch
     name: Doorbell notify
     icon: "mdi:bell-badge"
@@ -333,6 +337,7 @@ secondary_entities:
             icon: "mdi:volume-mute"
   - entity: button
     name: Factory reset
+    class: restart
     category: config
     dps:
       - id: 34

+ 6 - 1
custom_components/tuya_local/devices/zx_db11b_doorbell_alarm.yaml

@@ -264,7 +264,7 @@ secondary_entities:
     category: diagnostic
     dps:
       - id: 26
-        type: boolean
+        type: string
         name: sensor
         optional: true
         persist: false
@@ -272,6 +272,11 @@ secondary_entities:
           - dps_val: null
             value: false
           - value: true
+      - id: 26
+        type: string
+        name: alarm_msg
+        optional: true
+        persist: false
   - entity: switch
     name: Doorbell notify
     icon: "mdi:bell-badge"