Zwave Lock Manager

So, I got started with Home Assistant about 6 months ago. One of the things I really missed from SmartThings was a lock manager for my Schlage. Like many SmartThings converts, I had used a paid app developed by rboy. It worked great, and had lots of nice features. On the community here there was a wide array of automations, sensors, scripts, etc that provided some of the features, but not everything I wanted. The closest one to start was a long package file written by @nalipaz. This package had the ability to manage codes, including scheduled codes. This is where I started and then over time I have added a lot of additional sensor for information I cared about with help of @hejman08. Then a lot of templating help from @firstof9 @petro, I was able to really get this to where I wanted it.

Iā€™ll say there are still a few things that I have not gotten around to doing. The main things left that I may come back to in the future would be a scheduled recurring code, like M-F, 8am to 5pm, and the ability to disable some codes based on device trackers presence. Those are useful for a worker code for example, where you donā€™t want a worker using a code to get into the house when youā€™re at home. They can knock on the door then. :slight_smile: This one could be handled with other automations, and just did not want to over engineer this one.

Anyway, here is what this package does at the moment. Allows management of 18 slots (that was more than enough for me, easy enough to figure out how to add more if you like).

Slot Schedules:

  • Always (permanent)
  • Reoccurring ā€“ This will disable based on schedule, but wonā€™t delete name or code in HA
  • Temporary ā€“ This will remove the code and the name of the person at the end of the schedule time

One time use slot with Random Code:

I have slots 15-18 set up to allow one-time use. As soon as they are used, the code is deleted and removed from the lock.

onetime%20use
Sensors

Door report will tell you if the door was unlocked with a code, which code and name, unlocked with HA, Locked with HA, manually unlocked, manually locked, which person last unlocked the door with a code.

sensor

Everything above should work on most zwave locks. I know that itā€™s been tested with Yale, and Iā€™ve used it with a different schlage lock as well.

Zwave configuration (Only works with Schlage)

My most recent addition was to add a simple way to configure zwave options for Schalge Locks. I have BE469, and tested with those only.

This simple input select allows you to set the various options. You can set these in the zwave control panel as well, but some people like to have something more in the HA UI.

Some background info. The input selects used for the zwave are ordered so that the selection you see is the default option. If youā€™ve never changed your configuration, they theyā€™ll be correct. If you have made any changes to your settings, these input selects will not match your settings, If thatā€™s your case, just set them how you want the lock to be configured and it will all match.

I created two packages, named them with .txt so they donā€™t interfere with my system:

If you only have one zwave lock use this

https://github.com/ptdalen/home-assistant/blob/master/packages/lock_package_for_one_deadbolt.txt

If you have two zwave locks use this:

https://github.com/ptdalen/home-assistant/blob/master/packages/lock_package_for_two_deadbolts.txt

And if youā€™re like me and have three you can use the one Iā€™m using

https://github.com/ptdalen/home-assistant/blob/master/packages/door_locks.yaml

Iā€™ll try to keep them all updated, but the one Iā€™m using is most likely to be fully up to date and

To use these create a put the yaml from the file you choose into a package file under the packages directory.

Lastly Iā€™ll say that there are many long threads about schlage, and other zwave locks such as this one

So I hesitated as to if creating a new post was the right thing to do. Ultimately for me I felt like it was because I know how many different posts I had to comb through to get all of this together. I thought it would be good to have a lock manager thread. Enjoy

EDIT: This package is old and outdated, but still has some good examples of automations, etc. It was designed using the depreciated zwave 1.4. I have no intentions on maintaining this package as the Keymaster integration is far superior and updated often. Itā€™s what Iā€™m using now.

45 Likes

This is great thank you!

This looks amazing and I absolutely plan to try to implement this into my system! Thank you for sharing! I would not have found this buried into someone elseā€™s thread, so again, thanks for making this post!

Can you give more details on the installation? Iā€™m not sure where the packages directory is.

Here is info on packages

From there. Just copy the appropriate lock package into the folder and rename the entities for your lock(s) as listed into the package.

That should get you started. :slight_smile:

1 Like

Thanks for creating this package! Iā€™ve got my Schlage BE469 connected, and the package (one_deadbolt) modified to reflect correct sensor, lock, and zwave entity names. When I run a configuration validation, I get an error stating ā€œInvalid config for [automation]: required key not provided @ data[ā€˜actionā€™]. Got None
required key not provided @ data[ā€˜triggerā€™]. Got None. (See ?, line ?)ā€

Iā€™m new to home assistant, whatā€™s the best way to go about debugging these config errors?

Hmm, those errors are almost always a typo, either something missing, or spacing. Itā€™s possible I had a typo. Does it provide a line number? in the error, it often does, but not always. Iā€™ll also have a look. Basically for the one lock and two locks, I just did a lot of editing and did not run it directly, so itā€™s possible I had a typo.

Unfortunately it states (See ?, line ?), Iā€™m assuming this is normally where the line number would be.

1 Like

No worries. I went through the package one more time. Nothing Jumped out, so I took my main (working) package and cleaned it up again for one lock, and updated github.

Try it again, I was much more careful this time. It should work.

https://github.com/ptdalen/home-assistant/blob/master/packages/lock_package_for_one_deadbolt.txt

Make sure not to adjust any of the spacing in the file, also just to make sure your configuration.yaml has packages set up the same as mine it should be under homeassistant: like this

homeassistant:
  packages: !include_dir_named packages

See if that works for you

1 Like

Nice work - does this work without the ā€˜OZW clear NULL user codes patchā€™?
Will give this a try this week :smiley:

Itā€™s works either way. Comment out the one that does not work. The yaml has comments to show what to do

Oh wow. Didnā€™t look all the way through it - very impressive! Thanks for sharing!

1 Like

This looks great. In the script you say:

Update 9/4/18 - I have updated my openzwave for the locks and the clear usercode now works.

This is just updating openzwave package in general? Or do I need to do something specific on the lock?

So I, forked the openzwave branch a while back to include a fix for schlage locks when it came to clearing out user codes. If you have not done that, and you have a schlage lock, then you should comment out the section of ā€œclear codesā€ where it sets the code to ā€˜0000ā€™ and uncomment the section where it sets the code to a random number.

Oh great, thanks. I definitely want that feature, Iā€™ve been avoiding using code schedules and things like that specifically because I donā€™t like the inability to clear codes.

I guess I need to download the fork and compile it myself then? Any guides on how to do that?

You should make a pull request, Iā€™m sure other people would want this feature also.

Oh, nevermind, found instructions in the install file:

Still think you should do a pull request though!

getting round to implementing this (and I am terrible at coding) - but some of the folks on discord have suggested using:
value_template: "{{ state_attr('zwave.front_door_lock', 'battery_level')|default(75) }}"
as it wont cause an error on restart when z-wave hasnt loaded and status is unknown, over:

value_template: "{% if states.zwave.lock_front_door_deadbolt %}
      {{ states.zwave.lock_front_door_deadbolt.attributes.battery_level }}
    {% else %}
      unknown
    {% endif %}"

iā€™m trying to learn a little (rather than just blindly copy) so would be good to understand what the benefit is
1 Like

Is this all exclusive to USB dongles? I have my lock paired to a Vera hub and the only entity I see on my states page is ā€˜lock.schlage_deadbolt_15ā€™ā€¦

How is the best way to rename the entity ID name for the locks ?