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

Add description for each DP and fix a bunch of them.

Jeremy Pare пре 11 месеци
родитељ
комит
abcd3fdd3d
1 измењених фајлова са 277 додато и 88 уклоњено
  1. 277 88
      custom_components/tuya_local/devices/hornbill_y4_smart_lock.yaml

+ 277 - 88
custom_components/tuya_local/devices/hornbill_y4_smart_lock.yaml

@@ -2,146 +2,234 @@ name: Keypad lock
 products:
   - id: g7rboh0x
     manufacturer: Hornbill
-    model: Smart Lock
-    name: Key safe
+    name: Hornbill Y4 Smart Lock
 entities:
   - entity: lock
     dps:
+      # [Add unlocking method] After the device is online, add unlocking
+      # methods. Support adding fingerprint, password, card and face unlocking
+      # methods; support administrator tagging.
       - id: 1
         type: string
-        name: unlock_method_create
         optional: true
         sensitive: true
+        name: unlock_method_create
+      # [Delete unlocking method] After the device is online, delete the
+      # unlocking method. Supports deleting fingerprint, password, card and
+      # face unlocking methods. This dp appears in pairs with the added dp.
       - id: 2
         type: string
-        name: unlock_method_delete
         optional: true
+        sensitive: true
+        name: unlock_method_delete
+      # [Modify unlocking method] After the device is online, you can modify
+      # the name of the unlocking method and the content of the password.
       - id: 3
         type: string
-        name: unlock_method_modify
         optional: true
-        sensitive: true
+        name: unlock_method_modify
+      # [Report unlocking record] is used for the device to report the record
+      # of fingerprint unlocking. This dp is only enabled when the smart lock
+      # product has a fingerprint recognition function in the hardware.
       - id: 12
         type: integer
+        readonly: true
         name: unlock_fingerprint
         optional: true
         persist: false
+        range:
+          min: 0
+          max: 999
+      # [Report unlocking record] is used for the device to report the record
+      # of unlocking with ordinary password. This dp is enabled only when the
+      # hardware of this smart lock product has a password button that can be
+      # used to unlock the door with a password.
       - id: 13
         name: unlock_password
         type: integer
+        readonly: true
         optional: true
         persist: false
+        range:
+          min: 0
+          max: 999
+      # [Report unlocking record] is used for the device to report the door
+      # card unlocking record. This dp is enabled only when the smart lock
+      # product has a card swiping function in the hardware and can report the
+      # card swiping record.
       - id: 15
         name: unlock_card
         type: integer
+        readonly: true
         optional: true
         persist: false
+        range:
+          min: 0
+          max: 999
+      # [Report unlocking record] If the device supports detection of door
+      # opening from the inside, it is used for the device to report the record
+      # of door opening from the inside. This dp is enabled only when the
+      # hardware of this smart lock product can detect and identify unlocking
+      # from the inside and can report the data.
       - id: 18
         name: open_inside
         type: boolean
+        readonly: true
         optional: true
+      # [Report unlocking record] is used for the device to report the door
+      # opening record generated by the mobile phone app Bluetooth unlocking.
+      # Generally, all Bluetooth locks support this function.
       - id: 19
         name: unlock_ble
         type: integer
+        readonly: true
         optional: true
         persist: false
-      - id: 46
-        name: manual_lock
+        range:
+          min: 0
+          max: 999
+      # [Report lock record] is used for the device to report the lock record.
+      # If the lock is controlled by the mobile phone app or the lock is
+      # manually closed locally, this dp can be used to report.
+      - id: 20
+        type: string
+        optional: true
+        name: lock_record
+      # [Device Status] is used to report the status of the device clutch
+      # switch, that is, the switch status of the lock. This dp is enabled only
+      # when the product hardware supports the detection of the lock status.
+      - id: 47
         type: boolean
-        mapping:
-          - dps_val: true  # Unlocked
-            value: false
-          - dps_val: false  # Locked
-            value: true
-      - id: 47  # Lock motor state
+        optional: true
         name: lock_motor_state
-        type: boolean
         readonly: true
-        mapping:
-          - dps_val: true  # Unlocked
-            value: false
-          - dps_val: false  # Locked
-            value: true
+      # [Online Temporary Password] is used to add an online temporary
+      # password, and supports setting time periods and recurring time limits.
       - id: 51
         type: string
-        name: temporary_password_creat
         optional: true
         sensitive: true
+        name: temporary_password_create
+      # [Online temporary password] is used to delete the online temporary
+      # password.
       - id: 52
         type: string
-        name: temporary_password_delete
         optional: true
         persist: false
-        sensitive: true
+        name: temporary_password_delete
+      # [Online temporary password] is used to modify the password content and
+      # corresponding validity period of the online temporary password.
       - id: 53
         type: string
-        name: temporary_password_modify
         optional: true
-        persist: false
         sensitive: true
+        persist: false
+        name: temporary_password_modify
+      # [Synchronous unlocking method] is used to synchronize all unlocking
+      # methods on the local device with the mobile phone. It is strongly
+      # recommended to enable this function.
       - id: 54
         type: string
-        name: temporary_passynch_methodword_delete
         optional: true
         persist: false
         sensitive: true
+        name: synch_method
+      # [Report unlocking record] is used for the device to report the record
+      # of online temporary password unlocking.
       - id: 55
         type: integer
         name: unlock_temp_pwd
         optional: true
         persist: false
+        range:
+          min: 0
+          max: 999
+      # [Remote unlocking operation] is used to trigger the remote unlocking
+      # operation of the device. It is recommended to enable this DP and
+      # develop this function. Only when this function is supported and the
+      # door lock is connected to the Bluetooth gateway, can the voice control
+      # door opening and closing function be realized with smart speaker
+      # products such as Alexa or Google Home.
       - id: 61
         type: string
-        name: remote_no_dp_key
         optional: true
         persist: false
         sensitive: true
+        name: remote_no_dp_key
+      # [Report unlocking records] is used for the device to report the records
+      # of remote unlocking via mobile phone.
       - id: 62
         type: integer
         name: unlock_app
         optional: true
         persist: false
+        range:
+          min: 0
+          max: 999
+      # [Report unlocking record] is used for the device to report the record
+      # of voice unlocking. This function depends on dp61 = remote door opening
+      # (with verification code). It needs to be enabled with dp62 and pay for
+      # the voice door opening value-added service at the iot platform
+      # value-added service center before this function can be used.
       - id: 63
         type: integer
         name: unlock_voice
         optional: true
         persist: false
+        range:
+          min: 0
+          max: 999
+      # [Offline Password] is used to synchronize the timestamp between the
+      # cloud and the device. If it is not selected or not synchronized, the
+      # offline password will not be available.
       - id: 64
         type: string
-        name: password_offline_time
         optional: true
         persist: false
-        sensitive: true
+        name: password_offline_time
+      # [Offline password clear] When a single offline password is cleared
+      # locally on the device, the clearing operation record is reported.
       - id: 65
         type: string
-        name: unlock_offline_clear_single
         optional: true
         persist: false
-        sensitive: true
+        name: offline_pwd_cleared
+      # [Offline password clear] When all offline passwords are cleared locally
+      # on the device, the clearing operation record is reported.
       - id: 66
         type: string
-        name: unlock_offline_clear
         optional: true
         persist: false
         sensitive: true
+        name: unlock_offline_clear
+      # [Report unlocking record] is used for the device to report offline
+      # password unlocking records.
       - id: 67
         type: string
         name: unlock_offline_pwd
         optional: true
         persist: false
         sensitive: true
+      # [Bluetooth Unlock] is used to configure the verification information
+      # required when the device performs Bluetooth unlocking.
       - id: 70
         type: string
         name: check_code_set
         optional: true
         persist: false
         sensitive: true
+      # [Bluetooth Unlock] is used to trigger the device to perform Bluetooth
+      # unlocking. The trigger source can be a mobile phone, an accessory, or
+      # proximity unlocking.
       - id: 71
         type: string
         name: ble_unlock_check
         optional: true
         persist: false
         sensitive: true
+      # [Remote unlock] is used to configure the key required for remote
+      # unlocking. If the device needs to be unlocked remotely, this DP is
+      # required.
       - id: 73
         type: string
         name: remote_pd_setkey_check
@@ -151,14 +239,30 @@ entities:
   - entity: event
     name: Alert
     dps:
-      # TODO: Why not working? PR#2824 also didn't include it.
-      # - id: 20
-      #   type: string
-      #   name: lock_record
-      #   optional: ?
-      # alarm_lock
+      # [Alarm record] When an alarm occurs locally, it is used to report the
+      # alarm record of the device. Corresponding value description:
+      # 0=fingerprint trial error alarm
+      # 1=password trial error alarm
+      # 2=card trial error alarm
+      # 3=face trial error alarm
+      # 4=fake lock (lock tongue stuck)
+      # 5=high temperature alarm
+      # 6=timeout failure to close the door
+      # 7=electronic lock tongue not popped up
+      # 8=anti-pry alarm, 9=key insertion
+      # 10=low power alarm,
+      # 11=battery exhaustion alarm
+      # 12=vibration alarm
+      # 13=arming alarm
+      # If the device only uses a few items in the alarm dp, the redundant
+      # content does not need to be deleted. If deleted, the serial number of
+      # the MCU needs to be adjusted when reporting. It is recommended that
+      # developers do not change the enumeration value in the alarm. In special
+      # circumstances, please add, delete, and configure multiple languages
+      # under the guidance of pm.
       - id: 21
         type: string
+        readonly: true
         name: event
         optional: true
         mapping:
@@ -192,7 +296,11 @@ entities:
             value: defense
           - dps_val: wrong_unlock
             value: wrong_unlock
-      # doorbell_song
+      # [Doorbell] If the local doorbell ringtone of the device supports
+      # switching, you can use this DP to switch the local doorbell ringtone of
+      # the door lock on the app; this DP is only enabled if the hardware of
+      # this smart lock product supports doorbell ringtone switching and the
+      # user is allowed to switch on the app.
       - id: 26
         type: string
         name: event
@@ -202,6 +310,51 @@ entities:
             value: ding_0
           - dps_val: ding_1
             value: ding_1
+  # [Device Status] is used to display the power level in percentage. The range
+  # is -1 to 100. When the device reports a value of -1, the power level is not
+  # displayed. (Choose one from DP9).
+  - entity: sensor
+    class: battery
+    dps:
+      - id: 8
+        type: integer
+        readonly: true
+        name: sensor
+        unit: "%"
+        optional: true
+  # [Language] is used to set the playback language of the local navigation
+  # voice of the device.
+  # 0 = Simplified Chinese
+  # 1 = English
+  # 2 = Japanese
+  # 3 = German
+  # 4 = Spanish
+  # 5 = Latin
+  # 6 = French
+  # 7 = Russian
+  # 8 = Italian
+  # 9 = Traditional Chinese
+  # 10 = Korean
+  # This dp is only enabled if the hardware of this smart lock product supports
+  # language switching and allows users to switch on the app.
+  - entity: select
+    translation_key: language
+    category: config
+    name: Door Lock Language
+    dps:
+      - id: 28
+        type: string
+        name: option
+        optional: true
+        mapping:
+          - dps_val: chinese_simplified
+            value: chinese
+          - dps_val: english
+            value: english
+  # [Volume] is used to set the volume of the local navigation voice of the
+  # device. This dp is only enabled when the hardware of this smart lock
+  # product supports door lock volume adjustment and the user is allowed to
+  # switch the operation on the app.
   - entity: select
     name: Lock volume
     category: config
@@ -209,6 +362,7 @@ entities:
       - id: 31
         type: string
         name: option
+        optional: true
         mapping:
           - dps_val: mute
             value: Mute
@@ -218,14 +372,28 @@ entities:
             value: Normal
           - dps_val: high
             value: High
-  - entity: switch
-    name: reverse_lock
-    category: config
-    icon: "mdi:screen-lock-rotation"
-    dps:
-      - id: 32
-        type: boolean
-        name: switch
+  # [Device Status] If the device has indoor anti-lock detection, it is used to
+  # report the switch status of indoor anti-lock. Only select this dp when the
+  # hardware of this smart lock product can detect the anti-lock status and
+  # report the data. This dp is only used to display the anti-lock status on
+  # the door lock home page interface, and cannot perform anti-lock setting
+  # operations.
+  # Commented since DP gets reported even if the device doesn't support it.
+  # - entity: switch
+  #   name: Indoor Anti-Lock
+  #   category: config
+  #   dps:
+  #     - id: 32
+  #       type: boolean
+  #       name: switch
+  #       optional: true
+  # [Automatic Lock] is used to set the switch of the automatic locking
+  # function. Through this dp, you can set "Enable automatic locking" and "No
+  # automatic locking", that is, the device will not automatically lock, and it
+  # can also be used as a normally open mode. Only when the door lock hardware
+  # supports this setting, enable this dp and dp36, "Automatic Lock Delay" can
+  # be used together to achieve "Automatic Lock after Unlocking xx Seconds" to
+  # set the waiting time for automatic locking after unlocking.
   - entity: switch
     name: Automatic Lock
     category: config
@@ -234,59 +402,80 @@ entities:
       - id: 33
         type: boolean
         name: switch
+        optional: true
+  # [Automatic Lock] is used to set the delay time from unlocking the device to
+  # automatically locking the device. The setting range is 1s to 30min.
   - entity: number
     name: Automatic Lock Delay
-    class: duration
     icon: "mdi:lock-clock"
     category: config
     dps:
       - id: 36
         type: integer
         name: value
+        optional: true
         unit: s
         range:
           min: 1
           max: 1800
-  - entity: select
-    name: Approach Unlock Delay
-    category: config
-    dps:
-      - id: 89
-        type: string
-        name: option
-        mapping:
-          - dps_val: inactive
-            value: Inactive
-          - dps_val: 4s
-            value: 4s
-          - dps_val: 6s
-            value: 6s
-          - dps_val: 8s
-            value: 8s
-          - dps_val: 10s
-            value: 10s
-          - dps_val: 12s
-            value: 12s
-  - entity: sensor
-    class: battery
-    category: diagnostic
-    dps:
-      - id: 8
-        type: integer
-        name: sensor
-        unit: "%"
-        class: measurement
-        optional: true
-  - entity: select
-    translation_key: language
+  # [Device Status] If the device has door opening and closing status
+  # detection, it is used to report the door opening and closing status. Only
+  # enable this dp if this function is supported.
+  # Commented since DP gets reported even if the device doesn't support it.
+  # - entity: select
+  #   category: config
+  #   name: Door Status
+  #   dps:
+  #     - id: 40
+  #       type: string
+  #       name: option
+  #       readonly: true
+  #       optional: true
+  #       mapping:
+  #         - dps_val: unknown
+  #           value: Unknown
+  #         - dps_val: open
+  #           value: Open
+  #         - dps_val: closed
+  #           value: Closed
+  # [Lock Operation] is used to trigger the device to perform the lock
+  # operation, which can be used for automatic lock and manual lock operation.
+  # To report the lock (close) record, you need to use dp=20 lock record. You
+  # need to use 2 dp in combination to fully implement the lock operation and
+  # lock record reporting. In addition to these two dp, you also need to use
+  # dp47=lock status to report the lock status, so that the unlock/lock status
+  # displayed on the app is consistent with the local hardware.
+  - entity: lock
+    name: Lock/Unlock
+    icon: "mdi:door-closed-lock"
     category: config
     dps:
-      - id: 28
-        type: string
-        name: option
+      - id: 46
+        type: boolean
+        name: lock
         optional: true
-        mapping:
-          - dps_val: chinese_simplified
-            value: chinese
-          - dps_val: english
-            value: english
+  # [Approach Unlock] is used to set the delay time of automatic locking in the
+  # approach unlock scenario. If it is not enabled, the original automatic
+  # locking delay time will be retained.
+  # Commented since DP gets reported even if the device doesn't support it.
+  # - entity: select
+  #   name: Approach Unlock Delay
+  #   category: config
+  #   dps:
+  #     - id: 89
+  #       type: string
+  #       name: option
+  #       optional: true
+  #       mapping:
+  #         - dps_val: inactive
+  #           value: Inactive
+  #         - dps_val: 4s
+  #           value: 4s
+  #         - dps_val: 6s
+  #           value: 6s
+  #         - dps_val: 8s
+  #           value: 8s
+  #         - dps_val: 10s
+  #           value: 10s
+  #         - dps_val: 12s
+  #           value: 12s