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

Nice Digi lock: events require explicit mapping.

HA wants a list of events, and to match any incoming event type
against that list, so we cannot allow arbitrary event reporting.

Issue #1714

- same issue found in Single phase clamp meter, and Tonepie T1Pro
  cat litter box.
Jason Rumney 1 год назад
Родитель
Сommit
30fc5ecf3f

+ 2 - 0
ACKNOWLEDGEMENTS.md

@@ -547,3 +547,5 @@ Further device support has been made with the assistance of users. Please consid
 - [jan-gerard](https://github.com/jan-gerard) for contributing support for Eurom Sani towel rails.
 - [gkwok1](https://github.com/gkwok1) for contributing support for Confortotal mini split air conditioners.
 - [hroussez](https://github.com/hroussez) for contributing ANWIO lightbulb compatibility info.
+- [bdraco](https://github.com/bdraco) for advice on correct use of HA threading/task functions.
+4

+ 15 - 0
custom_components/tuya_local/devices/nice_digi_lock.yaml

@@ -85,6 +85,21 @@ secondary_entities:
         type: string
         name: event
         optional: true
+        mapping:
+          - dps_val: wrong_finger
+            value: wrong_finger
+          - dps_val: wrong_password
+            value: wrong_password
+          - dps_val: wrong_card
+            value: wrong_card
+          - dps_val: low_battery
+            value: low_battery
+          - dps_val: power_off
+            value: power_off
+          - dps_val: tongue_bad
+            value: tongue_bad
+          - dps_val: unclosed_time
+            value: unclosed_time
   - entity: binary_sensor
     name: Snib
     class: lock

+ 5 - 0
custom_components/tuya_local/devices/single_phase_clamp_meter.yaml

@@ -35,6 +35,11 @@ secondary_entities:
       - id: 101
         type: string
         name: event
+        mapping:
+          - dps_val: idle
+            value: idle
+          - dps_val: request
+            value: request
   - entity: select
     name: Real time
     icon: "mdi:connection"

+ 5 - 0
custom_components/tuya_local/devices/tonepie_t1pro_catlitterbox.yaml

@@ -81,6 +81,11 @@ secondary_entities:
         name: event
         optional: true
         persist: false
+        mapping:
+          - dps_val: true
+            value: full
+          - dps_val: false
+            value: null
   - entity: binary_sensor
     class: occupancy
     icon: "mdi:cat"