KeyMaster Z-Wave lock manager and scheduler

So I just tried this by searching for all automations with the word keymaster, using select all and it moved a few hundred of them and not others.

Turns out the hundreds of others have no unique ID or something so it won’t work.

I was curious about this custom notification. I am getting this error:
Message malformed: invalid template (TemplateSyntaxError: Encountered unknown tag 'states'.) for dictionary value @ data['trigger'][0]['variables']['notify_state']

This is the relevant section:

notify_state: >-
        {% states("input_boolean.notify_" + trigger.event.data.lockname + "_" + code_slot | string) %}

When I comment out this section as well as the section below, I get a new error.

Commented out section:

- condition: template
       value_template: "{% notify_state == \"on\" %}"

New error:
Message malformed: invalid template (TemplateSyntaxError: Encountered unknown tag 'sn'.) for dictionary value @ data['action'][1]['if'][0]['value_template']

I am not getting any notifications for Keymaster even though I have the manual script modified the way that I need. In the automations for user and lock notify, it shows that they have never run. They used to before I had to remove and readd my locks. I get a notification when the door opens and closes which uses the Keymaster automation, and it is showing as running. I’m wondering if it’s tied to keymaster_lock_state_changed never firing. How can I test this theory and/or fix the issue.

I have lock and door notifications enabled (and showing enabled) via the lovelace card.

To add more, I looked at the zwave_js events for last night when I unlocked the door with my code and then manually relocked it:

10/14/2024, 7:14:41 PM - notification
Arg 0:
113
Arg 1:
└─type: 6
└─event: 6
└─label: Access Control
└─eventLabel: Keypad unlock operation
└─parameters
└──userId: 1

and then:

10/14/2024, 7:14:59 PM - notification
Arg 0:
113
Arg 1:
└─type: 6
└─event: 1
└─label: Access Control
└─eventLabel: Manual lock operation

UPDATE:
I tried subscribing to the event keymaster_lock_state_changed but it did not fire when manually locking/unlocking or when using a user code to lock/unlock.’

UPDATE2:
I resaved the two locks and now keymaster_lock_state_changed is firing and calling script but it’s not sending notification. Script looks good to me. Do you see anything wrong here? Again, it’s working for door open/close.

keymaster_rear_door_manual_notify:
  mode: parallel
  sequence:
  - service: notify.telegram
    data:
      title: '{{ title }}'
      message: '{{ message }}'
    enabled: true
keymaster_front_door_manual_notify:
  mode: parallel
  sequence:
  - service: notify.telegram
    data:
      title: '{{ title }}'
      message: '{{ message }}'
    enabled: true

Ive have just repaired this integration after months where all entities showed up as unavailable, thankfully the lock and codes still worked. After reconfiguring and fixing one of the automations (I think thats what did it) all came back.
I was wondering however and given I have a very basic setup (1 lock/5 Users) if there was a way in which I could check the log/history to see when a particular user unlocked. I managed to get the “notification” working, but rather just want a log to see a user access. Thanks

I think the easiest way to do this would be to setup a telegram bot for notifications, then you can review the Telegram chat for the ‘access log’

Of course, the ZWAVE Addon will have a log, but it will be the user number not name. You can have that log saved to a file and filter out ‘keypad unlock’ events.

For my experience, Telegram would be the easiest and best way to do this.

Thanks for that. The Zwave logbook only shows locked and unlocked. But maybe ill try the Telegram route. Just smazed that theres not this basic log within keymaster. Thanks.

If you want to log entries, you setup an automation for that yourself.
You can use the logbook.log action.

1 Like

Coming over from SmartThings and some pretty robust code management systems and trying to wrap my head around this tool and HomeAssistant’s basic operations. I’ve read over the KeyMaster install page about a dozen times, gotten as far as searching/downloading the various lovelace add-ons via HACS, but seem to have only had the system dump a bunch of generic/nondescript time, date, and days of the week into my primary HA dashboard. Is this expected?

I see from the instructions that a lot of these values are presented as binary toggles, but how do I filter these down so there’s not just an endless list of unlabeled options?

If you’re using the auto-generated dashboard, then I would strongly recommend you stop doing that if you’re using Keymaster, please take some time and build a more useful to you dashboard. Please note that you aren’t the only one that finds the abundance of entities that Keymaster creates a bit overwhelming :wink:

Now that that particular comment is out of the way, Keymaster does offer a generated dashboard that you can use the documentation related it is here. If you have a lot of code slots defined for management, the page can get very big and kinda slow so you may want to take that and create a more custom dashboard after the fact, but at least you’ll have a better understanding of what all the entities are for.

For instance, this is the dashboard I’ve created for one of my rental properties:


the sections are roll-ups and by default all but the Airbnb section is rolled up, I expanded the others for the screen shot. Selecting one of the slots then brings me to a sub-view that is just that slots data
Selection_017
with the details exactly the same as they were from the Keymaster generated dashboard

Hi tykeal. My apologies for being such a noob but I am struggling with this one. If time permits and you are up for it can I ask for some additional help. So what I found is using the code below that whenever the bottom portion where it says ‘the2’ is when I am manually keying in the code and would like for it to only show when these occur. Would you be able to help remove the Manual ones (or all others in this case). Also I purposely add ‘the1’ and ‘the2’ for testing and I’ve yet to ever see ‘the1’ pop up. Its either ‘the2’ on manual code entry, and the others are ‘the’ which is not even listed in the code which confuses me.

alias: SS - Lock Logging2
description: Custom Keymaster Notification
mode: single
triggers:
  - event_type: keymaster_lock_state_changed
    event_data:
      state: unlocked
    variables:
      sn: |-
        {%- if trigger.event.data.code_slot_name == "" -%}
          Manual
        {%- else -%}
          {{ trigger.event.data.code_slot_name }}
        {%- endif -%}
      verb: |-
        {%- if trigger.event.data.code_slot_name == "" -%}
          unlock of
        {%- else -%}
          unlocked
        {%- endif -%}
      door: |-
        {%- if trigger.event.data.lockname == "front_door" -%}
          Front Door
        {%- elif trigger.event.data.lockname == "laundry_room" -%}
          Laundry Room Door
        {%- else -%}
          Garage Side Door
        {%- endif -%}
      code_slot: trigger.event.data.code_slot
      notify_state: >-
        {{ states('input_boolean.notify_' + trigger.event.data.lockname + '_ +
        code_slot | string') }}
    trigger: event
conditions: []
actions:
  - data:
      name: "{{ trigger.event.data.lockname }}"
      entity_id: "{{ trigger.event.data.entity_id }}"
      message: "{{ sn }} {{ verb }} the1 {{ door }}"
    action: logbook.log
  - if:
      - condition: template
        value_template: "{{ sn != 'Manual' }}"
    then:
      - metadata: {}
        data:
          message: "{{ sn }} {{ verb }} the2 {{ door }}"
          title: "{{ door }}"
          data:
            tag: "{{ door }}"
        action: notify.mobile_app_ss_s24u

I’m confused by your statements here.

You’re stating that you get a mobile notification when you use a door code correct?

Reading the code you’ve provided that should be the only time you get a mobile notification. You should not receive a mobile notification for any event except for when a code programmed into the lock is used.

As for your the1 that would be going to the Home Assistant logbook and should be capturing all unlock events, both manual, and code based. It is not going to go to your mobile notification.

“Manual” means that no door code was used. As in, a key was used or the lock was manually opened from the inside.

If you are still receiving other notifications as well then you probably have another notification script in play. The one above should be used in place of the manual notify script that Keymaster tries to use. Ideally you don’t have notifications turned on at all for your lock so Keymaster won’t try to use any of the notify scripts and it just relies on the automation you have.

Getting the below error on my newly added second BE469ZP Schlage lock. Everything I look at seems to be setup correctly. I have the script and it’s formatted exactly the same as the existing front door script that I’ve had. Anyone point me in the right direction?

alias: keymaster_back_door_manual_notify
sequence:
-data:
title: “{{ title }}”
message: “{{ message }}”
data:
ttl: 0
priority: high
action: notify.family
mode: parallel
description: “”

image

@tykeal thanks so much for providing this response and additional context, which sounds very similar to what I’m trying to create inside of HA. Part of the challenge of HA’s documentation is there’s al lot that’s assumed which can steepen the learning curve with many of us coming from existing solutions with entirely different paradigms and terminology.

After re-pasting the Lovelace code into a new dashboard I can confirm I was able to get that custom dashboard usable for creating those lock codes, which was a great feeling to see working! However, it seems like if I change Keymaster’s settings to add additional slots, I do need to re-paste that Lovelace code back into the dashboard, which I assume is expected?

My next step is try and get a calendar of bookings incorporated as triggers for code generation. Since I couldn’t find anyway to do this with the native CalDAV tool (which wants an authenticated session versus open ICS feed), I setup the ICS Calendar HACS integration, which seems to work wonderfully to generate a calendar of bookings, which I’m hoping I can use as a means to activate/deactivate guest codes (?).

You mentioned AirBnB codes you’re using, were you able to create those automatically off a calendar feed or are those just manually created by hand?

Thanks again for the help here. Definitely a great feeling when you see HA integrations like this working as shown and can see what might be possible if you could connect one tool to another.

Yes, I’m using Rental Control which I wrote to sit in top of Keymaster.

You will probably want to uninstall the ICS integration as it uses an older version of the ICS library and will end up in conflict with Rental Control

1 Like

Thank you! You were completely right. When messing around I had some other automation that I inconveniently named something different (no reference to lock in there) so my searching wasnt returning anything. Thanks again for the help.

I am using Keymaster 0.0.98. I had to re-configure everything because I had to reset and newly pair one of my locks.
Now in the UI everything looks different than when I installed it last time and I can not figure out how to change the time window for the “Night Auto-Lock” function. It just does it on sunset which is currently around 6pm, but I know I had it set at a certain time of night before… For now I changed it to the same as day, auto lock after 15mins. It would be nice to have it change to auto lock after 5 min after let’s say 9:30pm…
How do I set that up?

I would recommend that if you want specific times for the lock to be auto-locking at different timeouts that you do so via a custom automation and not use the auto-lock option from KeyMaster. As you just stated, KeyMaster is following the sun for when it should be using the day or night timings.

Thanks Andrew. I’ll give this a shot!

Not sure what I am doing wrong. I installed keymaster tonight. I made sure that the packages prereq is configured in configuration.yaml. After I install the integration, setup my lock, and install the Lovelace UI, it’s sort of working but the UI is showing some errors and I can’t set the lock code. Can anyone offer any advice? I have removed the integration and added it several times. The lock itself is setup in HA and I can lock/unlock it fine from it’s device.

image