Super Simple Lock Manager available

I developed my own super simple lock manager for my Zwave Kwikset locks. Posting the code in case it’s useful to anyone else. I had been using keymaster, which was very functional, but overkill for my needs and created a lot of helpers, scripts and automations which were cluttering my system.

The key difference is that this solution requires only 24 helpers (for 8 lock codes) and 2 automations (with some small modifications to specify your lock entities and notification service).

markaggar/HA_Simple_Lock_Manager: Simple Zwave Lock Manager (github.com)

9 Likes

I did something similar. Keymaster is massively bloated and not reliable.

This is exactly what I was looking for!

I simplified the install process, making it a package and a single place in the file to edit. I may add it to HACS or try to convert it to a blueprint, but probably won’t unless I get bored.

3 Likes

Nice! Thanks for doing this. Now need to make sure more people see this post!

3 Likes

This looks great. You should post in the keymaster thread. Its way too bloated for me to deal with - this seems much more manageable!

Would be great if this could be installed by HACS - would get a lot of distribution that way too.

Thanks for this! I can’t get my notify working though. Any solution? I changed my device to “mobile_app_pixel_7_pro_ha_app”

That’s a service, not a device. Calling the service will send a notification to the device associated with service. Have you tested that this service works?

Thank you so much! I’ve always manually deleted a ton of stuff in Keymaster, which is always a pain, and I’ve had it on my to do list for a while to create my own custom component. Thank you for saving me the trouble!

1 Like

Do I need to have keymaster already installed for this one?

No. In fact you should uninstall it first if you are already using it.

1 Like

Good stuff. Forgive my ignorance, but the codes I enter are not working in my lock. Do I need to blow out all of my existing codes? I’ve added a name, entered a code, and selected enabled. Anything else I need to do?

Assuming it’s a zwave lock (only works with zwave), you might need to factory reset the lock so all your old codes are cleared

1 Like

ok, I’ll try that. Thanks

Thanks for doing this! I also started off with keymaster and was frustrated by the ridiculous number of helpers it created that cluttered everything up so much, and I don’t have any need for daily scheduling. I did like a couple things it had though like the status bar at the top of the dashboard, so I copied some of those, including the autolock implementation (which adds a few more helpers and automations, but at least they’re useful…and I just added one instead of a separate day and night). Once I finish getting everything how I want it might do a pull request to see if you want to add it to the repo (though I also reduced it to 4 user codes to further declutter!). I’d like to create a more proper integration that could installed more easily, but like most people, I probably can’t be bothered after getting it where I need it!

For sure! Or at the minimum add a note in the ReadMe to your fork.

I would like to get something in HACS, but I am in the same boat as you. If it works, why mess with it more?

Thank you for the great work, this is exactly what I needed and it is working like a charm.
I slightly modified the configuration to include the ability to notify a keypad lock operation besides showing the user set device name of the exact log that is being locked/unlocked:

keymaster_basic.yaml

# Keymaster Basic
# Simple lock code manager for Home Assistant

# Add your locks here
lock:
  - platform: group
    name: "House Locks"
    entities:
      - lock.door_some_lock

# Add notification services
notify:
  - name: "Lock Notify Group"
    platform: group
    services:
        - service: some_notification_service_expect_messages
###############################
##  NO CHANGES NEEDED BELOW  ##
##    PROCEED WITH CAUTION   ##
###############################
automation:
  - alias: Set Lock Codes
    description: Set Key Codes on Locks
    trigger:
      - platform: state
        entity_id:
          - input_text.lock_code_slot_1_pin
          - input_text.lock_code_slot_2_pin
          - input_text.lock_code_slot_3_pin
          - input_text.lock_code_slot_4_pin
          - input_text.lock_code_slot_5_pin
          - input_text.lock_code_slot_6_pin
          - input_text.lock_code_slot_7_pin
          - input_text.lock_code_slot_8_pin
        for:
          hours: 0
          minutes: 0
          seconds: 5
        id: PIN
      - platform: state
        entity_id:
          - input_boolean.lock_code_slot_1_state
          - input_boolean.lock_code_slot_2_state
          - input_boolean.lock_code_slot_3_state
          - input_boolean.lock_code_slot_4_state
          - input_boolean.lock_code_slot_5_state
          - input_boolean.lock_code_slot_6_state
          - input_boolean.lock_code_slot_7_state
          - input_boolean.lock_code_slot_8_state
        id: Disable
        to: "off"
      - platform: state
        entity_id:
          - input_boolean.lock_code_slot_1_state
          - input_boolean.lock_code_slot_2_state
          - input_boolean.lock_code_slot_3_state
          - input_boolean.lock_code_slot_4_state
          - input_boolean.lock_code_slot_5_state
          - input_boolean.lock_code_slot_6_state
          - input_boolean.lock_code_slot_7_state
          - input_boolean.lock_code_slot_8_state
        id: PIN
        to: "on"
    condition: []
    action:
      - choose:
          - conditions:
              - condition: trigger
                id: PIN
              - condition: template
                value_template: >-
                  {% set mysensor = "input_boolean.lock_code_slot_" ~
                  (trigger.entity_id | replace('.','z') | list | sort | first | int)
                  ~ "_state" %}

                  {{is_state(mysensor,'on')}} 
            sequence:
              - service: zwave_js.set_lock_usercode
                data:
                  usercode: >-
                    {% set mysensor = "input_text.lock_code_slot_" ~
                    (trigger.entity_id | replace('.','z') | list | sort | first |
                    int) ~ "_PIN" %}   {{states(mysensor)}}
                  code_slot: >-
                    {{trigger.entity_id | replace('.','z') | list | sort | first |
                    int}}
                target:
                  entity_id: >-
                    {{ states.lock.house_locks.attributes.entity_id }}
                enabled: true
          - conditions:
              - condition: trigger
                id: Disable
            sequence:
              - service: zwave_js.clear_lock_usercode
                data:
                  code_slot: >-
                    {{trigger.entity_id | replace('.','z') | list | sort | first |
                    int}}
                target:
                  entity_id: >-
                    {{ states.lock.house_locks.attributes.entity_id }}
    mode: queued
    max: 10

  - alias: Lock Notifications
    description: "notify when certain codes are used to unlock the doors, if notify is enabled"
    trigger:
      - platform: event
        event_type: zwave_js_notification
        event_data:
          command_class: 113
          command_class_name: Notification
          label: Access Control
          type: 6
          event: 6
          event_label: Keypad unlock operation
        id: unlock
      - platform: event
        event_type: zwave_js_notification
        event_data:
          command_class: 113
          command_class_name: Notification
          label: Access Control
          type: 6
          event: 5
          event_label: Keypad lock operation
        id: lock
    condition: []
    action:
      - service: input_text.set_value
        data:
          value: "{{trigger.event | replace('>','') | last}}"
        target:
          entity_id: input_text.last_lock_unlock_code_slot
      - choose:
          - conditions:
              - condition: trigger
                id: unlock
              - condition: template
                value_template: |2
                      {% set mysensor = "input_boolean.lock_code_slot_" ~ states('input_text.last_lock_unlock_code_slot') ~ "_notify" %}  
                      {{is_state(mysensor, 'on') }}
            sequence:
              - service: notify.lock_notify_group
                data:
                  message: >-
                    {% set namesensor = "input_text.lock_code_slot_" ~
                    states('input_text.last_lock_unlock_code_slot') ~ "_name" %} {{
                    states(namesensor)}} unlocked the {{device_attr(trigger.event.data.device_id, "name_by_user")}} via keypad at
                    {{as_timestamp(states.input_text.last_lock_unlock_code_slot.last_changed)
                    | timestamp_custom("%H:%M:%S",local=True)}}
          - conditions:
              - condition: trigger
                id: lock
              - condition: template
                value_template: |2
                      {% set mysensor = "input_boolean.lock_keypad_lock_notify" %}  
                      {{is_state(mysensor, 'on') }}
            sequence:
              - service: notify.lock_notify_group
                data:
                  message: >-
                    {{device_attr(trigger.event.data.device_id, "name_by_user")}} is locked via keypad at
                    {{as_timestamp(trigger.event.time_fired)
                    | timestamp_custom("%H:%M:%S",local=True)}}
    mode: single

# Needed Variables
input_boolean:
  lock_code_slot_1_state:
    name: Lock Code Slot 1 State
    icon: mdi:lock-check
  lock_code_slot_1_notify:
    name: Lock Code Slot 1 Notify
    icon: mdi:alarm-bell 
  lock_code_slot_2_state:
    name: Lock Code Slot 2 State
    icon: mdi:lock-check
  lock_code_slot_2_notify:
    name: Lock Code Slot 2 Notify
    icon: mdi:alarm-bell
  lock_code_slot_3_state:
    name: Lock Code Slot 3 State
    icon: mdi:lock-check
  lock_code_slot_3_notify:
    name: Lock Code Slot 3 Notify
    icon: mdi:alarm-bell
  lock_code_slot_4_state:
    name: Lock Code Slot 4 State
    icon: mdi:lock-check
  lock_code_slot_4_notify:
    name: Lock Code Slot 4 Notify
    icon: mdi:alarm-bell 
  lock_code_slot_5_state:
    name: Lock Code Slot 5 State
    icon: mdi:lock-check
  lock_code_slot_5_notify:
    name: Lock Code Slot 5 Notify
    icon: mdi:alarm-bell
  lock_code_slot_6_state:
    name: Lock Code Slot 6 State
    icon: mdi:lock-check
  lock_code_slot_6_notify:
    name: Lock Code Slot 6 Notify
    icon: mdi:alarm-bell
  lock_code_slot_7_state:
    name: Lock Code Slot 7 State
    icon: mdi:lock-check
  lock_code_slot_7_notify:
    name: Lock Code Slot 7 Notify
    icon: mdi:alarm-bell
  lock_code_slot_8_state:
    name: Lock Code Slot 8 State
    icon: mdi:lock-check
  lock_code_slot_8_notify:
    name: Lock Code Slot 8 Notify
    icon: mdi:alarm-bell
  lock_keypad_lock_notify:
    name: Lock Keypad Lock Notify
    icon: mdi:alarm-bell

input_text:
  last_lock_unlock_code_slot:
    name: Last Used Code Slot
    icon: mdi:account
  lock_code_slot_1_pin:
    name: Lock Code Slot 1 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_1_name:
    name: Lock Code Slot 1 Name
    icon: mdi:account
  lock_code_slot_2_pin:
    name: Lock Code Slot 2 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_2_name:
    name: Lock Code Slot 2 Name
    icon: mdi:account
  lock_code_slot_3_pin:
    name: Lock Code Slot 3 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_3_name:
    name: Lock Code Slot 3 Name
    icon: mdi:account
  lock_code_slot_4_pin:
    name: Lock Code Slot 4 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_4_name:
    name: Lock Code Slot 4 Name
    icon: mdi:account
  lock_code_slot_5_pin:
    name: Lock Code Slot 5 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_5_name:
    name: Lock Code Slot 5 Name
    icon: mdi:account
  lock_code_slot_6_pin:
    name: Lock Code Slot 6 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_6_name:
    name: Lock Code Slot 6 Name
    icon: mdi:account
  lock_code_slot_7_pin:
    name: Lock Code Slot 7 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_7_name:
    name: Lock Code Slot 7 Name
    icon: mdi:account
  lock_code_slot_8_pin:
    name: Lock Code Slot 8 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_8_name:
    name: Lock Code Slot 8 Name
    icon: mdi:account

keymaster_lovelace_dashboard.yaml

views:
  - title: Keymaster
    theme: Backend-selected
    path: keymaster
    badges: []
    cards:
      - type: vertical-stack
        cards:
          - content: |
              ## Code 1
            type: markdown
          - type: entities
            show_header_toggle: false
            entities:
              - entity: input_text.lock_code_slot_1_name
                secondary_info: none
                name: Name
              - entity: input_text.lock_code_slot_1_pin
                name: Code
              - type: divider
              - entity: input_boolean.lock_code_slot_1_state
                name: Enabled
              - entity: input_boolean.lock_code_slot_1_notify
                name: Notify
      - type: vertical-stack
        cards:
          - content: |
              ## Code 2
            type: markdown
          - type: entities
            show_header_toggle: false
            entities:
              - entity: input_text.lock_code_slot_2_name
                secondary_info: none
                name: Name
              - entity: input_text.lock_code_slot_2_pin
                name: Code
              - type: divider
              - entity: input_boolean.lock_code_slot_2_state
                name: Enabled
              - entity: input_boolean.lock_code_slot_2_notify
                name: Notify
      - type: vertical-stack
        cards:
          - content: |
              ## Code 3
            type: markdown
          - type: entities
            show_header_toggle: false
            entities:
              - entity: input_text.lock_code_slot_3_name
                secondary_info: none
                name: Name
              - entity: input_text.lock_code_slot_3_pin
                name: Code
              - type: divider
              - entity: input_boolean.lock_code_slot_3_state
                name: Enabled
              - entity: input_boolean.lock_code_slot_3_notify
                name: Notify
      - type: vertical-stack
        cards:
          - content: |
              ## Code 4
            type: markdown
          - type: entities
            show_header_toggle: false
            entities:
              - entity: input_text.lock_code_slot_4_name
                secondary_info: none
                name: Name
              - entity: input_text.lock_code_slot_4_pin
                name: Code
              - type: divider
              - entity: input_boolean.lock_code_slot_4_state
                name: Enabled
              - entity: input_boolean.lock_code_slot_4_notify
                name: Notify
      - type: vertical-stack
        cards:
          - content: |
              ## Code 5
            type: markdown
          - type: entities
            show_header_toggle: false
            entities:
              - entity: input_text.lock_code_slot_5_name
                secondary_info: none
                name: Name
              - entity: input_text.lock_code_slot_5_pin
                name: Code
              - type: divider
              - entity: input_boolean.lock_code_slot_5_state
                name: Enabled
              - entity: input_boolean.lock_code_slot_5_notify
                name: Notify
      - type: vertical-stack
        cards:
          - content: |
              ## Code 6
            type: markdown
          - type: entities
            show_header_toggle: false
            entities:
              - entity: input_text.lock_code_slot_6_name
                secondary_info: none
                name: Name
              - entity: input_text.lock_code_slot_6_pin
                name: Code
              - type: divider
              - entity: input_boolean.lock_code_slot_6_state
                name: Enabled
              - entity: input_boolean.lock_code_slot_6_notify
                name: Notify
      - type: vertical-stack
        cards:
          - content: |
              ## Code 7
            type: markdown
          - type: entities
            show_header_toggle: false
            entities:
              - entity: input_text.lock_code_slot_7_name
                secondary_info: none
                name: Name
              - entity: input_text.lock_code_slot_7_pin
                name: Code
              - type: divider
              - entity: input_boolean.lock_code_slot_7_state
                name: Enabled
              - entity: input_boolean.lock_code_slot_7_notify
                name: Notify
      - type: vertical-stack
        cards:
          - content: |
              ## Code 8
            type: markdown
          - type: entities
            show_header_toggle: false
            entities:
              - entity: input_text.lock_code_slot_8_name
                secondary_info: none
                name: Name
              - entity: input_text.lock_code_slot_8_pin
                name: Code
              - type: divider
              - entity: input_boolean.lock_code_slot_8_state
                name: Enabled
              - entity: input_boolean.lock_code_slot_8_notify
                name: Notify
      - type: vertical-stack
        cards:
          - content: |
              ## Keypad Lock
            type: markdown
          - type: entities
            show_header_toggle: false
            entities:
              - entity: input_boolean.lock_keypad_lock_notify
                name: Notify

For those would like to also log the detailed notifications to Logbook so you can see them under the entity id of “Lock Notifications”:

keymaster_basic.yaml

# Keymaster Basic
# Simple lock code manager for Home Assistant

# Add your locks here
lock:
  - platform: group
    name: "House Locks"
    entities:
      - lock.some_door_lock # change me

# Add notification services
notify:
  - name: "Lock Notify Group"
    platform: group
    services:
        - service: notification_service_accpet_message # change me
###############################
##  NO CHANGES NEEDED BELOW  ##
##    PROCEED WITH CAUTION   ##
###############################
automation:
  - alias: Set Lock Codes
    description: Set Key Codes on Locks
    trigger:
      - platform: state
        entity_id:
          - input_text.lock_code_slot_1_pin
          - input_text.lock_code_slot_2_pin
          - input_text.lock_code_slot_3_pin
          - input_text.lock_code_slot_4_pin
          - input_text.lock_code_slot_5_pin
          - input_text.lock_code_slot_6_pin
          - input_text.lock_code_slot_7_pin
          - input_text.lock_code_slot_8_pin
        for:
          hours: 0
          minutes: 0
          seconds: 5
        id: PIN
      - platform: state
        entity_id:
          - input_boolean.lock_code_slot_1_state
          - input_boolean.lock_code_slot_2_state
          - input_boolean.lock_code_slot_3_state
          - input_boolean.lock_code_slot_4_state
          - input_boolean.lock_code_slot_5_state
          - input_boolean.lock_code_slot_6_state
          - input_boolean.lock_code_slot_7_state
          - input_boolean.lock_code_slot_8_state
        id: Disable
        to: "off"
      - platform: state
        entity_id:
          - input_boolean.lock_code_slot_1_state
          - input_boolean.lock_code_slot_2_state
          - input_boolean.lock_code_slot_3_state
          - input_boolean.lock_code_slot_4_state
          - input_boolean.lock_code_slot_5_state
          - input_boolean.lock_code_slot_6_state
          - input_boolean.lock_code_slot_7_state
          - input_boolean.lock_code_slot_8_state
        id: PIN
        to: "on"
    condition: []
    action:
      - choose:
          - conditions:
              - condition: trigger
                id: PIN
              - condition: template
                value_template: >-
                  {% set mysensor = "input_boolean.lock_code_slot_" ~
                  (trigger.entity_id | replace('.','z') | list | sort | first | int)
                  ~ "_state" %}

                  {{is_state(mysensor,'on')}} 
            sequence:
              - service: zwave_js.set_lock_usercode
                data:
                  usercode: >-
                    {% set mysensor = "input_text.lock_code_slot_" ~
                    (trigger.entity_id | replace('.','z') | list | sort | first |
                    int) ~ "_PIN" %}   {{states(mysensor)}}
                  code_slot: >-
                    {{trigger.entity_id | replace('.','z') | list | sort | first |
                    int}}
                target:
                  entity_id: >-
                    {{ states.lock.house_locks.attributes.entity_id }}
                enabled: true
          - conditions:
              - condition: trigger
                id: Disable
            sequence:
              - service: zwave_js.clear_lock_usercode
                data:
                  code_slot: >-
                    {{trigger.entity_id | replace('.','z') | list | sort | first |
                    int}}
                target:
                  entity_id: >-
                    {{ states.lock.house_locks.attributes.entity_id }}
    mode: queued
    max: 10

  - alias: Lock Notifications
    description: "notify when certain codes are used to unlock the doors, if notify is enabled"
    trigger:
      - platform: event
        event_type: zwave_js_notification
        event_data:
          command_class: 113
          command_class_name: Notification
          label: Access Control
          type: 6
          event: 6
          event_label: Keypad unlock operation
        id: unlock
      - platform: event
        event_type: zwave_js_notification
        event_data:
          command_class: 113
          command_class_name: Notification
          label: Access Control
          type: 6
          event: 5
          event_label: Keypad lock operation
        id: lock
    condition: []
    action:
      - service: input_text.set_value
        data:
          value: "{{trigger.event | replace('>','') | last}}"
        target:
          entity_id: input_text.last_lock_unlock_code_slot
      - choose:
          - conditions:
              - condition: trigger
                id: unlock
              - condition: template
                value_template: |2
                      {% set mysensor = "input_boolean.lock_code_slot_" ~ states('input_text.last_lock_unlock_code_slot') ~ "_notify" %}  
                      {{is_state(mysensor, 'on') }}
            sequence:
              - service: notify.lock_notify_group
                data:
                  message: >-
                    {% set namesensor = "input_text.lock_code_slot_" ~
                    states('input_text.last_lock_unlock_code_slot') ~ "_name" %} {{
                    states(namesensor)}} unlocked the {{device_attr(trigger.event.data.device_id, "name_by_user")}} via keypad at
                    {{as_timestamp(states.input_text.last_lock_unlock_code_slot.last_changed)
                    | timestamp_custom("%H:%M:%S",local=True)}}
              - service: logbook.log
                data:
                  message: >-
                    {% set namesensor = "input_text.lock_code_slot_" ~
                    states('input_text.last_lock_unlock_code_slot') ~ "_name" %} {{
                    states(namesensor)}} unlocked the {{device_attr(trigger.event.data.device_id, "name_by_user")}} via keypad at
                    {{as_timestamp(states.input_text.last_lock_unlock_code_slot.last_changed)
                    | timestamp_custom("%H:%M:%S",local=True)}}
                  name: >-
                    {{device_attr(trigger.event.data.device_id, "name_by_user")}} {{trigger.event.data.event_label}}
                  entity_id: "{{this.entity_id}}"
          - conditions:
              - condition: trigger
                id: lock
              - condition: template
                value_template: |2
                      {% set mysensor = "input_boolean.lock_keypad_lock_notify" %}  
                      {{is_state(mysensor, 'on') }}
            sequence:
              - service: notify.lock_notify_group
                data:
                  message: >-
                    {{device_attr(trigger.event.data.device_id, "name_by_user")}} is locked via keypad at
                    {{as_timestamp(trigger.event.time_fired)
                    | timestamp_custom("%H:%M:%S",local=True)}}
              - service: logbook.log
                data:
                  message: >-
                    {{device_attr(trigger.event.data.device_id, "name_by_user")}} is locked via keypad at
                    {{as_timestamp(trigger.event.time_fired)
                    | timestamp_custom("%H:%M:%S",local=True)}}
                  name: >-
                    {{device_attr(trigger.event.data.device_id, "name_by_user")}} {{trigger.event.data.event_label}}
                  entity_id: "{{this.entity_id}}"

    mode: single

# Needed Variables
input_boolean:
  lock_code_slot_1_state:
    name: Lock Code Slot 1 State
    icon: mdi:lock-check
  lock_code_slot_1_notify:
    name: Lock Code Slot 1 Notify
    icon: mdi:alarm-bell 
  lock_code_slot_2_state:
    name: Lock Code Slot 2 State
    icon: mdi:lock-check
  lock_code_slot_2_notify:
    name: Lock Code Slot 2 Notify
    icon: mdi:alarm-bell
  lock_code_slot_3_state:
    name: Lock Code Slot 3 State
    icon: mdi:lock-check
  lock_code_slot_3_notify:
    name: Lock Code Slot 3 Notify
    icon: mdi:alarm-bell
  lock_code_slot_4_state:
    name: Lock Code Slot 4 State
    icon: mdi:lock-check
  lock_code_slot_4_notify:
    name: Lock Code Slot 4 Notify
    icon: mdi:alarm-bell 
  lock_code_slot_5_state:
    name: Lock Code Slot 5 State
    icon: mdi:lock-check
  lock_code_slot_5_notify:
    name: Lock Code Slot 5 Notify
    icon: mdi:alarm-bell
  lock_code_slot_6_state:
    name: Lock Code Slot 6 State
    icon: mdi:lock-check
  lock_code_slot_6_notify:
    name: Lock Code Slot 6 Notify
    icon: mdi:alarm-bell
  lock_code_slot_7_state:
    name: Lock Code Slot 7 State
    icon: mdi:lock-check
  lock_code_slot_7_notify:
    name: Lock Code Slot 7 Notify
    icon: mdi:alarm-bell
  lock_code_slot_8_state:
    name: Lock Code Slot 8 State
    icon: mdi:lock-check
  lock_code_slot_8_notify:
    name: Lock Code Slot 8 Notify
    icon: mdi:alarm-bell
  lock_keypad_lock_notify:
    name: Lock Keypad Lock Notify
    icon: mdi:alarm-bell

input_text:
  last_lock_unlock_code_slot:
    name: Last Used Code Slot
    icon: mdi:account
  lock_code_slot_1_pin:
    name: Lock Code Slot 1 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_1_name:
    name: Lock Code Slot 1 Name
    icon: mdi:account
  lock_code_slot_2_pin:
    name: Lock Code Slot 2 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_2_name:
    name: Lock Code Slot 2 Name
    icon: mdi:account
  lock_code_slot_3_pin:
    name: Lock Code Slot 3 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_3_name:
    name: Lock Code Slot 3 Name
    icon: mdi:account
  lock_code_slot_4_pin:
    name: Lock Code Slot 4 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_4_name:
    name: Lock Code Slot 4 Name
    icon: mdi:account
  lock_code_slot_5_pin:
    name: Lock Code Slot 5 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_5_name:
    name: Lock Code Slot 5 Name
    icon: mdi:account
  lock_code_slot_6_pin:
    name: Lock Code Slot 6 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_6_name:
    name: Lock Code Slot 6 Name
    icon: mdi:account
  lock_code_slot_7_pin:
    name: Lock Code Slot 7 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_7_name:
    name: Lock Code Slot 7 Name
    icon: mdi:account
  lock_code_slot_8_pin:
    name: Lock Code Slot 8 PIN
    mode: password
    min: 4
    max: 10
    pattern: "[0-9]*"
    icon: mdi:form-textbox-password 
  lock_code_slot_8_name:
    name: Lock Code Slot 8 Name
    icon: mdi:account

Just wanted to say thank you. Keymaster was quite bloated and this works perfect with my Yale front door lock. The Schlage back door log is just a piece of shoot and will not update codes from scripts - ever. I’m replacing it with another Yale.

Tried this on one door and it works! Now I need to go do the other four and hopefully Zwave can keep up and doesn’t get bogged down trying to set the codes for multiple locks at the same time.

In terms of notifications, anyone have thoughts on how to include which door was opened in the notification?

In original code copied below at the bottom, I’m thinking we would need to add an additional variable under unlock_code_slot and then reference that variable in the message?

Looking into this a little bit, the zwave_js_notification doesn’t give an entity or friendly name, which is unfortunate. Here is the output for reference. So maybe we’d have to manually add in our device_id with a friendly name?

event_type: zwave_js_notification
data:
  domain: zwave_js
  node_id: 58
  home_id: 3806651701
  endpoint: 0
  device_id: 1909383be6125dc1125a4f660bf6f3ec
  command_class: 113
  command_class_name: Notification
  label: Access Control
  type: 6
  event: 6
  event_label: Keypad unlock operation
  parameters:
    userId: 1
origin: LOCAL
time_fired: "2024-03-04T18:55:32.781229+00:00"
context:
  id: 01HR5D4DXDERS362N15BMW54Z2
  parent_id: null
  user_id: null

Is there a way I can test changes quickly without having to restart Home Assistant every time I make a change? My “guess and test” method of coding becomes quite cumbersome with restarts.

Here’s the original notifications yaml:

  - alias: Lock Notifications
    description: "Notify when certain codes are used to unlock the doors, if notify is enabled"
    id: lock_notifications
    trigger:
      - platform: event
        event_type: zwave_js_notification
        event_data:
          command_class: 113
          command_class_name: Notification
          label: Access Control
          type: 6
          event: 6
          event_label: Keypad unlock operation
        variables:
          unlock_code_slot: "{{ trigger.event.data.parameters.userId }}"
    condition: []
    action:
      - choose:
          - conditions:
              - condition: template
                value_template: |
                  {% set mysensor = "input_boolean.lock_code_slot_" ~ unlock_code_slot ~ "_notify" %}  
                  {{is_state(mysensor, 'on') }}
            sequence:
              - service: notify.lock_notify_group
                data:
                  message: >-
                    {% set namesensor = "input_text.lock_code_slot_" ~
                    unlock_code_slot ~ "_name" %} {{
                    states(namesensor)}} unlocked the door at
                    {{ now().strftime('%H:%M') }}
    mode: single

for keymaster_basic.yaml all I do is replace these parts with my own entities? I put **around the parts

    entities:
      **- lock.front_door**
      **  - lock.another_door**

# Add notification services
notify:
  - name: "Lock Notify Group"
    platform: group
    services:
      **- service: mobile_app_desertblade_phone**
      ** - service: mobile_app_person_ha_app**

How do I find out what mine are called for these two?

      - service: mobile_app_desertblade_phone
      - service: mobile_app_person_ha_app

I want a separate dashboard for my locks so I created an entire new blank dashboard. I would use the raw configuration editor and copy everything from lovelace-keymaster-basic.yaml with no changes?

I get Entity not available.

image

# Add your locks here
lock:
  - platform: group
    name: "House Locks"
    entities:
      - lock.xxxx
      - lock.xxxx