KeyMaster Z-Wave lock manager and scheduler

keymaster_lock_state_changed is an event that @brenthaag is using. I use it myself for automation triggering and that event has not changed with the v0.1.x release series.

After countless hours of troubleshooting why my HA app notifications suddenly stopped working, I finally found a fix that worked for me, so I figured I’d share in case it helps someone else.

Before doing anything, I saved all of my codes from the Lovelace dashboard.
Then I removed my lock from Keymaster and, through HACS, uninstalled the Keymaster integration. I rebooted HA after each removal step.

After that, I reinstalled Keymaster and used the same Keymaster name as before.
Next, I deleted my entire Lovelace dashboard and added a new one from:

/homeassistant/custom_components/keymaster/lovelace/frontdoorlock.yaml

I pasted that into the bottom of the Raw Configuration Editor.

The only difference I noticed afterward is that the slot number now appears in the notification (in my case [23]). Not a problem, just an observation.

This fix worked for me on Keymaster v0.1.0.
Hope this helps anyone else running into the same issue!


You’re close, but looking at the “states” page. You need to check the “events” tab. (1)

On the events tab, paste the event name that @brenthaag mentioned keymaster_lock_state_changed (2), hit “start listening” (3) and then trigger an event by opening a deadbolt or keying in a pin.

You should see the events showing up immediately below. (4)

1 Like

Thank-you so much.
That worked a treat. I assume thats in a Wiki somewhere, apologies if I missed it but really appreciate your following up.

Anytime. :call_me_hand:t3:

I had a few hours of power outage and most things recovered without a problem, including HA except Keymaster. Keymaster was working fine for years. Current version is v0.1.0.

All the Automations are gone, and am mostly getting errors “Entity not found” on the default Lovelace page.

I read up this thread and I do not know how to fix this.

If I go to Settings–>Integration–>keymaster–>Integration entries, under the lock all the details and options are still there.

What is my path forward? I saw someone uninstall and reinstall. Is that the only safe bet?

All of the input_foo type entities that you list on that page are from Keymaster before v0.1.x. The current dashboard files are generated in custom_components/keymaster/lovelace/<lock>.yaml and need to be added to a new dashboard.

thank you. Hairless monkey that fell out of tree here.
So, what is the best approach for me? Get info out what is in there, uninstall, reinstall? or, click something, pull something, and bam, all good?

Well, if you update the dashboard with the newly generated one you should be good as long as there aren’t any actual problems with Keymaster

I figured it out. thanks!

I can’t seem to make my automation work since I don’t know where to fetch the info I need. I am trying to find the following:

User who unlocked the door based on pin used
Was it a manual unlock or a keypad unlock

My code so far:

- alias: Front Door – Save User and Notify

trigger:
  - platform: state
    entity_id: lock.front_door
    to: "unlocked"

action:
  - variables:
      last_user: "{{ state_attr('lock.front_door', 'icon') | default('unknown') }}"

  - service: camera.snapshot
    target:
      entity_id: camera.doorbell
    data:
      filename: /config/www/Camera/doorbell.jpg

  - service: input_text.set_value
    target:
      entity_id: input_text.front_door_last_user
    data:
      value: "{{ last_user }}"

  - delay: "00:00:01"

  - service: notify.notify
    data:
      title: "Front Door Unlocked"
      message: "{{ last_user }} unlocked the front door"
      data:
        image: /local/Camera/doorbell.jpg
        actions:
          - action: "URI"
            title: "View Live Feed"
            uri: "/dashboard-cameras/driveway"

Door lock: Schlage BE469NXCEN619

There are numerous instances of how to do something like this throughout this thread (yes, I know it’s a huge thread).

The most recent example that I posted is at KeyMaster Z-Wave lock manager and scheduler - #3058 by tykeal

You shouldn’t be using the lock state itself as the trigger as it’s not going to provide any of the data you’re after, but a platform event trigger with event_type keymaster_lock_state_changed will, as that is going to have the data you are wanting in it.

1 Like

So had to fix the code a little and added snapshot and a link to live feed:

automation:
  - alias: Front Door Lock
    description: Keymaster Front Door Notification

    trigger:
      - platform: event
        event_type: keymaster_lock_state_changed
        event_data:
          state: unlocked

    variables:
      sn: >-
        {% set name = trigger.event.data.code_slot_name | default('') %}
        {{ 'Manual' if name in ['', none] else name }}

      verb: >-
        {{ 'unlock of' if sn == 'Manual' else 'unlocked' }}

      door: "Front Door"

    action:
      - service: camera.snapshot
        target:
          entity_id: camera.doorbell
        data:
          filename: /config/www/snapshot/person.jpg

      - service: logbook.log
        data:
          name: "front_door"
          entity_id: "{{ trigger.event.data.entity_id }}"
          message: "{{ sn }} {{ verb }} the {{ door }}"

      - delay: "00:00:01"

      - service: notify.notify
        data:
          title: "{{ door }}"
          message: "{{ sn }} {{ verb }} the {{ door }}"
          data:
            tag: "front_door"
            image: /local/snapshot/person.jpg
            actions:
              - action: URI
                title: View Live Feed
                uri: "/dashboard-cameras/driveway"
1 Like

Is there somewhere that describes what each feature does in this? IE: Where can I set my night time and daytime for the auto-lock? What does enabling notifications do exactly? Does it notify every device? etc.

New user here, is there a way to configure the Auto Lock feature? I have set the sensor for each lock but do not see a way to adjust the timing of the auto lock.

You’re going to have to go to the device itself and configure the timers there the first time. After that you’ll be able to adjust them from the dashboard.

I see it now, thank you!!!

I finally upgraded to Keymaster 0.1.x. I love the new functionality and not having to manage entities through the packages manually.

One thing I’m noticing, there doesn’t appear to be a way to set the timeout for auto lock to be in increments less than a minute. I had several doors that were set at 30 seconds and one that was set at 90 seconds. Am I missing something or are whole number increments the only option now?

You are correct that whole number of minutes is how it’s now designed.

1 Like

I’ve upgraded to the latest keymaster version and am trying to get the custom dashboard working. If I create a new dashboard, then it works great, but if I want tabs within a current dashboard, I’m unable to get the tab’s to be named anything other than “unnamed view”

This is the code I’m using in the raw config editor for the dashboard. I’ve also tried without a “title” tag

  - strategy:
      type: custom:keymaster
      lock_name: Front Lock
      title: Front Lock
      icon: mdi:door-closed-lock
  - strategy:
      type: custom:keymaster
      lock_name: Garage Lock
      title: Garage Lock
  - strategy:
      type: custom:keymaster
      lock_name: Side Lock
      title: Side Lock

Also, If I manually name it with the pencil icon, that negates the whole dashboard as expected.