Zwave Lock Manager (Updated)

I initially posted a lock manager package back in Nov of 2018. It was something I had created for myself that I wanted to share with others. I built it piece by piece over months by reading through other peoples automations, sensors, scripts, and packages. During those months I learned a lot about how HA worked not just with locks and zwave, but much much more. I posted to github to share, but ultimately it was my package that I was using for myself. When I posted it, I expected that the people using the package would also have been spending time learning HA, and already have a fair understanding of how yaml works, how zwave works, etc. I expected that if you wanted to name your lock differently, that you would, you’d look through the yaml, and make the changes as needed. I tried to provide detailed comments, to make it easier. What I’ve noticed since this was posted is that most of the requests for assistance were actually yaml formatting, or zwave network issues. I just wanted to start with this comment to hopefully help new users who may come across this package.
Here are a few things to know before you get started

  • This lock package does not make your lock work on not work. It helps you to set codes into your lock, manage settings, etc. Everything this does can be done without this package. Home Assistant and Zwave are what makes your lock work.
  • Before you even get started with this package, I highly recommend. Getting your lock added Securely, see if you can lock and unlock it via Home assistant (no automations, needed, just find the lock entity.)
  • if you only have one or two zwave devices and the lock is one of those, and you find that your lock is not as responsive as it should be. This (or any package) will not make it work better. Sorry about that, getting a decent zwave mesh really makes a huge difference. Does not matter if it’s 6 feet from the zwave stick. if it does not work, nothing in HA will make it work better.
  • If you get errors about @data or triggers, etc. It’s a yaml formatting error. Usually it’s spacing somewhere. If you made no changes at all this package should and usually does work, and should have have formatting errors.
  • My package specifically requires you to rename a few of your entities. If you already have them added, and dont feel like renaming them, no problem. Have a look at the yaml, and make the changes as needed. There is a good amount of templating, which is usually the most likely cause of something breaking. But I tried my best to comment on where to make changes is needed.

Ok, now on to the details.

Before you get started make sure to have the following integrations and lovelace items configured and working

HACS (highly recommended)

For Lovelace:

OK now to the lock manager details

You can find my packages in my repository
Everyone needs the
common_lock_config.yaml
and at least one other lock package
front_door_lock.yaml
for example. I have three lock packages in the github reporitory. For me Front, back and garage door.

The garage door package is a little different from the other two as it was made for an schlage FE599 and they dont work exactly the same. If you dont have an FE599, I would not use this package.

So here are some details as to the capabilities of this package.
You’ll find several packges in the community. We all do pretty much the same thing. Set codes, clear codes, schedule codes, notify people, etc. This is no different.

I will start off with the basics. Setting user codes
Here is an example of what a slot looks like in lovelace before any data is entered

image

Once you enter a name and a code, you’ll be presented with additional options (conditional lovelace card does the work here)

Select your access schedule. The options are “Always or Scheduled”
image

Once you select the schedule (let’s start with Always) the code will load into the door lock that you turn on. When you turn off a door lock the code will be removed. So when you first start all locks will be off. Turn them on and the code get sent to the door. Note: Home assistant does not know what the codes are in the lock. It cannot read or pull existing codes. In this case it has an input text set as a code, it sends that text to the door. If you sent a code and then deleted home assistant or this package, the codes would still be there.

If you click on the enable notifications, you will get a notification when that code slot is used to unlock the door.
If you click on the delete code slot once the “lock” icon will disappear. Click on it a second time and it will clear the name and code from HA, and also clear the code from the lock.

At the bottom of the lovelace panel there are zwave options you can set and configure. These options are for schlage only. If you have a different lock, just remove the lovelace card.

Ok lets talk about scheduled codes. I chose to use google calendar intergration. What I really liked about using google calendar was the flexibility. Basically whatever you can set as a google calendar schedule you can have for your lock schedule.

I personally have a google account dedicated to Home Assistant which makes it easy to keep seperate from my personal account. But also I created a second calendar in my account just for lock codes. I have put a template for HA for my calendar to help get started

google_calendar_example.txt

Basically it works like this
Create a calendar event. Name of the event is the code slot you want to schedule
Example:

Select Scheduled in the HA lovelace front end and you’ll see something like this

For the scheduled events I also added a feature to delete when done. Just add the word delete in the description of the event. When the event ends, HA will clear the code and name from HA and the lock. This might be useful for a weekly rental. Maybe set a code for a full week, then when the event ends, it will be cleared, Or maybe you need to let someone in for a day, multiple times, but never again.

Speaking of deleting codes. There are also 3 one time use slots. They are pretty self explanatory . Enable the code. A random number will be generated, If you dont want to use that, change to what you want. Turn on the switch for the lock or locks you want and when the code is used on any of the enabled doors, it will be deleted from all doors.

Much of this is pretty simlimar to my old lock package

Most of the changes here are the calendar and a good amount of lovelace improvements to make it prettier

I hope this is useful to others. Enjoy.

I also wanted to give a shoutout to @FutureTense. His package - Simplified Zwave Lock Manager UPDATE
Helped to give me some great ideas on how to improve mine.

7 Likes

Are you getting a status back from the lock that the code has been added or updated? I have seen others that seem to be doing that using the alarm_type sensor but f I add a code the alarm_type value does not change.

Unfortunately, no. I cannot speak for newer locks, or different brands. But for the schlage be 469, Alarm type does not change with codes. I do have the codes listed in the “door report” sensor, but from what I’ve seen most locks dont report this. It may be an issue with the outdated zwave, not sure.

Maybe there is a way to parse the zwave logs? I’ll look into it, because I think that would be very useful

@ptdalen Actually zwave does report it. After you add a code to a slot you will see this in zwave logs.

Notice below after a code was added to slot 9 it reported that slot as occupied. Too bad HA is not capturing this data.

2020-05-14 15:55:27.664 Info, Node008, Response RTT 5312 Average Response RTT 3441
2020-05-14 15:55:27.664 Info, Node008, User Code Packet is 10
2020-05-14 15:55:27.664 Detail, Node008, Refreshed Value: old value=a107c1d0, new value=99d936d0, type=raw
2020-05-14 15:55:27.664 Detail, Node008, Changes to this value are not verified
2020-05-14 15:55:27.664 Info, Node008, Received User Code Report from node 8 for User Code 9 (Occupied)

I’m aware it reports it in the logs, but not aware how to parse that log, or get info from zwave that it has completed the actions. I’ve tested the listeners, and did not see it. I will say the other popular lock package on here, just turns on an input boolean at the end of the automation when a code is loaded, and turns it off when a code is removed. That is a great concept and not against it at all. It still does not know that the code was loaded though. Just that the automation to load the code was executed and the command was sent.

Edit: There is a new zwave process coming soon. Actually been out for a while, but I’m not ready to make the leap quite yet. zwave2MQTT. It uses zwave 1.6 vs current zwave 1.4, maybe that version will offer more robust zwave reporting @jaswalters

Its more of a lack of HA not grabbing that data in the add user code method vs lack in zwave. Unless your saying that hopefully with MQTT we will have better access to zwave messages?

I honestly dont know. Maybe 1.6 of zwave will provide better sensor information? 1.4 which is what we are using is quite old. Maybe we’ll have better access to zwave logging.

I’ve submitted a PR to get proper user code support for zwave locks in the ozw beta (1.6).
set_usercode, get_usercode, clear_usercode all work properly even on Kwikset locks.

Deleting a code reports Alarm Type 33 and Alarm Level <code slot> on my Kwikset 910. :slight_smile:

1 Like

@ptdalen

Thank you for creating this awesome integration! After reading through your documentation I was able to control both Yale YRD110 locks for codes. Awesomesauce!

1 Like

Just tried this integration and I have the following error:

 Error loading /config/configuration.yaml: mapping values are not allowed here
  in "/config/packages/common_lock_config.yaml", line 123, column 73
end of the stream or a document separator is expected at line 123, column 73:
     ... r-bar top-0 left-0" style="width: 0%;"></span>
                             ^

I installed the following:

Then in packages dir:
wget https://github.com/ptdalen/home-assistant/blob/c528484509e90bafcec4ff5410a5be8d48e64a75/packages/common_lock_config.yaml
wget https://github.com/ptdalen/home-assistant/blob/c528484509e90bafcec4ff5410a5be8d48e64a75/packages/front_door_lock.yaml
wget https://github.com/ptdalen/home-assistant/blob/c528484509e90bafcec4ff5410a5be8d48e64a75/packages/back_door_lock.yaml
mv back_door_lock.yaml garage_door_lock.yaml

Is Google Calendar a must have?

The error sounds like a typo somewhere. I assume you edited the common)_lock_config.yaml file to remove the third lock entry (garage)? Maybe you made a minor mistake. Check out line 123 in your yaml file. Look a few lines above as well.

As far as google calendar. It’s not a requirment per se. But if you want to use scheduled codes with this package, that is how it is configured. A while back I used input date times to accomplish the same thing, so if you dont want to use google calendar, but want scheduled codes it can definitely be done, just requires some rewrite.

Nope! Guess I shouldn’t do this stuff at 1 am!! So, I deleted my packages/*.yaml and re-downloaded all:

wget https://github.com/ptdalen/home-assistant/blob/c528484509e90bafcec4ff5410a5be8d48e64a75/packages/common_lock_config.yaml
wget https://github.com/ptdalen/home-assistant/blob/c528484509e90bafcec4ff5410a5be8d48e64a75/packages/front_door_lock.yaml
wget https://github.com/ptdalen/home-assistant/blob/c528484509e90bafcec4ff5410a5be8d48e64a75/packages/back_door_lock.yaml
wget https://github.com/ptdalen/home-assistant/blob/c528484509e90bafcec4ff5410a5be8d48e64a75/packages/garage_door_lock.yaml

Then, without editing anything, I checked configuration and it spews the same error, first on front_door so I removed that yaml and re-checked but same error now on back_door. Removed that yaml and then the same error but now in garage_door.yaml:

Error loading /config/configuration.yaml: mapping values are not allowed here
  in "/config/packages/common_lock_config.yaml", line 123, column 73
    120     <div class="position-relative js-header-wrapper ">
    121       <a href="#start-of-content" class="px-2 py-4 bg-blue text-white show-on-focus js-skip-to-content">Skip to content</a>
    122       <span class="Progress progress-pjax-loader position-fixed width-full js-pjax-loader-bar">
    123         <span class="progress-pjax-loader-bar top-0 left-0" style="width: 0%;"></span>
    124       </span>

I will admit, I’m not great about wget, etc. As in I tend to copy/paste my yaml.

With that said, it looks to me like whatever you are pulling down is not my raw code.

Line 123 should look about like this

        below: 19
    condition:
    - condition: and
      conditions:
        - condition: or
          conditions:
            - condition: template
              value_template: "{{ states.sensor.back_door_report.state.lower().startswith('keypad unlock') }}"
            - condition: template
              value_template: "{{ states.sensor.front_door_report.state.lower().startswith('keypad unlock') }}"
            - condition: template
              value_template: "{{ states.sensor.garage_door_report.state.lower().startswith('keypad unlock') }}"

Yep, like I said, don’t do this stuff at 1 am. So I did a git clone https://github.com/ptdalen/home-assistant.git and then copied the 4 yaml files to packages/ and check configuration is ok now. Now on to editing…

Thanks!

1 Like

@ptdalen have you tried using ozw with your package yet? I’m having a lot of issues with my package and figured you are probably having similar issues.

I have not made the jump yet. I really want to make the move, just to test it out, but have not had the dedicated time to fix any issues that will likely arise. I’m getting pretty close though, so when I do move I will definiitely post any issues I run into.

I finally deciced to try the new OZW. Everything worked well except the locks. No suprise. :slight_smile:

So here are the things that dont work for me. Access Control sensor is not enabled, and enabling it does not seem to add any benefit. I had to remove and then readd the locks to get the to show up properly, otherwise they just showed as unknown. I can lock and unlock via HA, and when I manually lock the locks, there is a new binary sensor that shows manually locked for a second or two before revering back to its standard “off” state. I suspect I could clear codes, send codes, lock and unlock just fine. But struggling with how to determine which code locked/unlocked the door. Have you had any success with user code slots yet, @FutureTense

I’m really interested to see how this progresses. I only have z-wave for my Schlage door locks and have been so underwhelmed by the built in lock integration that I don’t use it currently they are just there collecting dust in the interface.

I am wondering if there is a way to use a secrets file when setting the codes. Rather than entering the actual user code in the web interface, show !secret user1code for example.

I’m having the same issue with my Schlage BE469Z lock as well. No access control sensors even when I manually enable them - HA says unavailable. I tried exclude, factory reset, include and still no luck. However, my Kwikset Lock seems to send the access control sensor fine. Any luck on your end?