name: Door lock
products:
  - id: yfqp0shy
    manufacturer: Gainsborough
    model: Liberty Smart Entrance Lock
entities:
  - entity: lock
    dps:
      - id: 12
        type: integer
        name: unlock_fingerprint
        optional: true
        persist: false
      - id: 13
        name: unlock_password
        type: integer
        optional: true
        persist: false
      - id: 14
        name: unlock_dynamic_pwd
        type: integer
        optional: true
        persist: false
      - id: 15
        name: unlock_card
        type: integer
        optional: true
        persist: false
      - id: 16
        name: unlock_key
        type: integer
        optional: true
        persist: false
      - id: 19
        name: unlock_ble
        type: integer
        optional: true
        persist: false
      - id: 21
        name: jammed
        type: string
        optional: true
        persist: false
        mapping:
          - dps_val: tongue_bad
            value: true
          - dps_val: tongue_not_out
            value: true
          - dps_val: null
            value: false
          - value: false
      - id: 47  # Lock motor state
        name: lock_state
        type: boolean
        optional: true
        mapping:
          - dps_val: true  # Unlocked
            value: false
          - dps_val: false  # Locked
            value: true
      - id: 55
        type: integer
        name: unlock_temp_pwd
        optional: true
        persist: false
      - id: 61
        type: base64
        optional: true
        sensitive: true
        name: code_unlock
      - id: 62
        type: integer
        name: unlock_app
        optional: true
        persist: false
      - id: 63
        name: unlock_voice
        type: integer
        optional: true
        persist: false
      - id: 67
        type: string
        optional: true
        persist: false
        name: unlock_offline_pwd
        mapping:
          - dps_val: null
            value: null
          - value: 1
      - id: 67
        type: string
        optional: true
        sensitive: true
        name: offline_pwd_details
      - id: 69
        type: string
        optional: true
        name: log
      - id: 70
        type: string
        optional: true
        sensitive: true
        name: check_code_set
      - id: 71
        type: string
        optional: true
        sensitive: true
        name: ble_unlock_check
  - entity: sensor
    class: battery
    dps:
      - id: 8
        type: integer
        name: sensor
        unit: "%"
  - entity: sensor
    name: Alert
    class: enum
    category: diagnostic
    dps:
      - id: 21
        type: string
        name: sensor
        optional: true
        persist: false
        mapping:
          - dps_val: null
            value: ok
          - dps_val: wrong_finger
            value: Wrong Finger
          - dps_val: wrong_password
            value: Wrong Password
          - dps_val: wrong_card
            value: Wrong Card
          - dps_val: wrong_face
            value: Wrong Face
          - dps_val: tongue_bad
            value: Tongue Bad
          - dps_val: too_hot
            value: Too Hot
          - dps_val: unclosed_time
            value: Unclosed Time
          - dps_val: tongue_not_out
            value: Tongue Not Out
          - dps_val: pry
            value: Pry
          - dps_val: key_in
            value: Key In
          - dps_val: low_battery
            value: Low Battery
          - dps_val: power_off
            value: Power Off
          - dps_val: shock
            value: Shock
          - dps_val: defense
            value: Defense
          - dps_val: wrong_unlock
            value: Wrong Unlock
  - entity: event
    name: Hijack
    dps:
      - id: 22
        type: boolean
        name: event
        optional: true
        mapping:
          - dps_val: true
            value: hijack
          - dps_val: false
            value: null
  - entity: event
    class: doorbell
    dps:
      - id: 24
        type: boolean
        name: event
        optional: true
        mapping:
          - dps_val: true
            value: ring
          - dps_val: false
            value: null
  - entity: number
    name: Lock volume
    category: config
    dps:
      - id: 31
        type: string
        name: value
        optional: true
        unit: "%"
        range:
          min: 0
          max: 100
        mapping:
          - dps_val: mute
            step: 33
            value: 0
            icon: "mdi:volume-mute"
          - dps_val: low
            step: 33
            value: 33
            icon: "mdi:volume-low"
          - dps_val: mid
            step: 33
            value: 66
            icon: "mdi:volume-medium"
          - dps_val: high
            step: 33
            value: 100
            icon: "mdi:volume-high"
  - entity: lock
    name: Snib
    icon: "mdi:lock-remove"
    category: diagnostic
    dps:
      - id: 32
        type: boolean
        optional: true
        name: lock
        mapping:
          - dps_val: null
            value: false
            hidden: true
  - entity: switch
    name: Auto lock
    category: config
    icon: "mdi:lock-reset"
    dps:
      - id: 33
        type: boolean
        name: switch
        optional: true
        mapping:
          - dps_val: true
            value: false
          - dps_val: false
            value: true
  - entity: switch
    name: Multifactor
    category: config
    icon: "mdi:lock-check"
    dps:
      - id: 34
        type: string
        name: switch
        optional: true
        mapping:
          - dps_val: combination
            value: true
          - dps_val: single_unlock
            value: false
          - dps_val: null
            value: false
            hidden: true
  - entity: number
    name: Auto lock delay
    icon: "mdi:lock-clock"
    category: config
    dps:
      - id: 36
        type: integer
        name: value
        optional: true
        range:
          min: 0
          max: 1800
        unit: s
  - entity: switch
    name: Local clock
    category: config
    dps:
      - id: 44
        type: boolean
        name: switch
        optional: true
        mapping:
          - dps_val: null
            value: false
            hidden: true
  - entity: lock
    name: Lockdown
    icon: "mdi:key-alert"
    category: config
    dps:
      - id: 46
        type: boolean
        name: lock
        optional: true
  - entity: text
    name: New credential
    category: config
    icon: "mdi:card-plus"
    hidden: true
    dps:
      - id: 1
        type: base64
        name: value
        optional: true
        sensitive: true
  - entity: text
    name: Delete credential
    category: config
    icon: "mdi:card-minus"
    hidden: true
    dps:
      - id: 2
        type: base64
        name: value
        optional: true
        sensitive: true
  - entity: text
    name: Modify credential
    category: config
    icon: "mdi:credit-card-edit"
    hidden: true
    dps:
      - id: 3
        type: base64
        name: value
        optional: true
        sensitive: true
  - entity: text
    name: New temp password
    category: config
    icon: "mdi:lock-open-plus"
    hidden: true
    dps:
      - id: 51
        type: base64
        optional: true
        sensitive: true
        name: value
  - entity: text
    name: Delete temp password
    category: config
    icon: "mdi:lock-open-minus"
    hidden: true
    dps:
      - id: 52
        type: base64
        optional: true
        sensitive: true
        name: value
  - entity: text
    name: Modify temp password
    category: config
    icon: "mdi:pencil-lock"
    hidden: true
    dps:
      - id: 53
        type: string
        optional: true
        sensitive: true
        name: value
  - entity: text
    name: Sync credentials
    category: config
    icon: "mdi:lock-reset"
    hidden: true
    dps:
      - id: 54
        type: base64
        optional: true
        sensitive: true
        name: value
  - entity: text
    name: Offline password timestamp
    category: config
    icon: "mdi:clock-digital"
    hidden: true
    dps:
      - id: 64
        type: string
        optional: true
        name: value
  - entity: sensor
    name: Used offline password
    category: diagnostic
    icon: "mdi:lock-open-minus"
    dps:
      - id: 65
        type: string
        optional: true
        sensitive: true
        name: sensor
  - entity: sensor
    name: Clear offline passwords
    icon: "mdi:lock-open-remove"
    category: diagnostic
    hidden: true
    dps:
      - id: 66
        type: string
        optional: true
        sensitive: true
        name: sensor
  - entity: text
    name: Remote unlock code
    category: config
    icon: "mdi:form-textbox-password"
    hidden: true
    dps:
      - id: 72
        type: string
        optional: true
        sensitive: true
        name: value
