KeyMaster Z-Wave lock manager and scheduler

My original AutoLock code did check for door status. But in order to port it to the integration I found it easier to simplify things and just assume the door is shut. I can add it back in, but I’ll need to replace every lock command with a new function that checks to see if the door is shut before locking. But then we go down the rabbit hole as what to do if the door is open. Try again in 30 seconds? Send a notification? Or simply do nothing. I’d be curious as what people would like to see happen.

1 Like

FutureTense,

Thank you for responding!
Personally, because we leave our door open when the weather is nice, I would prefer to see the auto-lock countdown start when the door is closed. If the door is opened before the time is up, the timer should reset and wait until the door is closed again. But that is just my wishes… lol!

2 Likes

My vote would be for the automation to wait for the door to close to lock if the timer expires with the door open. Something like:

Timer Expires → Closed → Lock
Timer Expired → Open → Wait → Closed → Lock

2 Likes

The lock manager I was using on SmartThings before migrating over to HA had the following autolock options:

Autolock after X time (just do it)
Toggle: Only lock after close, with added requirement for door sensor
Toggle: Auto unlock if locked while open, with the same door sensor being required and timeout before unlocking (default 1 min)

The third one is useful for cases where you’ve got a deadbolt that gets locked while the door is open, having the auto-unlock feature meant that it would get re-unlocked as long as the door was open so that the bolt wouldn’t get slammed into the door frame if closed and you didn’t realize it was locked! It also had the hard requirement that if you had a hardware option for autolock (like Kwikset locks do) that it’s disabled.

1 Like

I’m having trouble getting this working at all with my Schlage Connect lock. Whenever I try to set a code I get this message in the Zwave log Controller status: Driver: UserCodeCCSet: The user ID must be between 0 and the number of supported users 0. and the status in Keymaster just stays on Adding. My existing codes don’t show up in any of the Keymaster slots either. I am able to enable and disable slots, and set the codes via the Zwave control panel directly though. EDIT: Turns out I have the same problem setting it from the Zwave control panel. It looked like it was working, but when I checked the logs I saw the same message, and when I refreshed the page the settings reverted. Anyone have any idea what I need to do to get code setting working over zwave?

v0.0.59 if sensor is open and autolock fires, timer is extended by 30 seconds. Will repeat until it solves itself.

@FutureTense my door open logic tries to lock the door every 15 seconds up to 6 times. If the door is still unlocked then it sends a message to the user that locking the door has failed.

Maybe you could have user inputs on the configuration for people to specify number of retries, retry delay, and drop-down to notify all users, admin users, or no notification?

Is there any way to incorporate a lock logic similar to this one I have set up? This does exactly what I was looking for… waits 5 minutes after the door is closed to then locks. This is from my automations.yaml

  alias: Front Door Auto Lock
  description: ''
  trigger:
  - type: not_opened
    platform: device
    device_id: blahblahblah
    entity_id: binary_sensor.front_door_ias_zone
    domain: binary_sensor
    for:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  condition:
  - condition: device
    device_id: blahblahblah
    domain: lock
    entity_id: lock.assure_touchscreen_deadbolt
    type: is_unlocked
  action:
  - device_id: blahblahblah
    domain: lock
    entity_id: lock.assure_touchscreen_deadbolt
    type: lock
  mode: single

If this could be setup in keymaster that would be pretty awesome!

I am stuck on adding but I have been unable to fins any logs on what is erroring out. Where should I be looking for logs?

I am using zwavejs2mqtt addon (with mqtt disabled) rather than regular zwavejs addon. This lets you have a control panel where you can view zwave logs and edit zwave device settings.

I have the same setup but with debug enabled in zwavejs2mqtt. I’m not seeing anything happening the logs but I do see that sensor.frontdoor_code_slot_1 is unavailable.

That’s far outside of the scope I’m interested in supporting. A lots involved to make custom settings, and for ones that most people won’t use, I have to ask if the juice is worth the squeeze.

Do we really want to try and lock an “opened” door, meaning not just unlocked but not closed? Obviously the answer is “no”. What I’ve done is when the auto lock timer expires is test to see if the door is opened. If it is not (or the sensor doesn’t exist) the deadbolt locks. Otherwise the timer starts again with 30 seconds. Eventually when the door is shut it will lock. Perhaps I’ll change it to start the timer only when the door is closed.

1 Like

The native code does that, with 15 minutes during daylight hours and 5 minutes for night. You can modify those values if you want.

I figured out my issue, there were a couple. Main one was that I had to re-interview the lock. It was showing options for 5 user codes under the user codes section of zwave control panel, but after re-interviewing, it started properly showing 30. The other issue was that keymaster had the status deleting for the first 5 pin codes. To fix this, I had to manually set those 5 user code slots to available in the zwave control panel. After those 2 things everything is working as expected!

I also finally got it working for the Schlage Connect. What I had to do was disable all my user codes in the zwavejs2mqtt web UI. Then I made them all available and set the user code as 0000. Next I went to the KeyMaster lovelace and licked reset code slot and then added a name, a code, and enable the code. I watched as the codes populated the zwavejs2mqtt web UI. Lovelace is still stuck on “adding” but I can see it was successfully added.

Issues: I still can’t get Code 1 to work but I got all the others to work. Lovelace is not disabling the codes or reseting any of them.

I will say it’s days like these that make me miss SmartThings.

Yes, frustrations abound. You might want to just factory reset your lock and re-include it.

Thanks! That looks like it resolved the issue.

(Note: I accidentally cross-posted this question on GitHub: ISSUE: Code slot with advanced Day of Week settings stuck in "Connecting"/"Disconnecting" · Issue #202 · FutureTense/keymaster · GitHub)

I deleted my Lovelace views for both locks and deleted the contents of /packages/keymaster to “freshen things up,” but the integration keeps saying “Name already in use.” What else do I need to do to clear the remnants of the old locks out to finish reinstalling this integration? I briefly tried naming it another name, but the UI seemed to be stuck in a user input error by that time. Here’s a picture of the error when I try to reproduce it:

…and here’s a screenshot of the contents of my /packages/keymaster folder:

Did you delete the existing integration as well in your Integrations tab?

Hi,

First off, thank you for sharing this extension, it’s been a great tool for configuring codes and getting alerts.

I noticed that recently alerts stopped firing for all door and lock events. I captured events via developer tools[0] but did not see the keymaster_lock_state_changed event fire that I think I’m expecting, from scanning the code.

I had this issue as of a few days ago, and figured it was a HA / Keymaster version issue. I’ve since updated both HA and KeyMaster, but am still not getting notifications. Did something change here?

On the latest version, I did do the backward incompatibility fix (prefixing my notify scripts with keymaster_). The event log[0] I shared is on the latest KeyMaster version on HACS (v0.0.61)

[0] { "event_type": "state_changed", "data": { "entity_id": "auto - Pastebin.com