ZWave Locks and Logging for the former Vera crowd

So I finally jumped back into the home automation game with a raspberry PI3 and home assistant. I didn’t want to leave my old Vera unit plugged in just so I can set and clear codes on my locks based on labels so I’ve been fumbling my way through something to do that under HA.

I’ve put together some custom components and a custom panel to let me do that as well as logging information when someone enters a code or when multiple bad codes are entered in succession. My code and configuration files are all up on github.

One note, being able to clear codes on the locks are dependent on a patch to the openzwave library that pyopenzwave uses. It hasn’t been accepted yet.


I made a couple updates to the frontend panel to make it look a little less amateur. I also realized I never talked about configuration. The files you want are:

  • custom_components/
  • custom_components/ (only working with BE369 locks at this time)
  • panels/locks.html

And the configuration.yaml changes:

usercode:   # This is the zwave user code piece
locklogger:  # This is what logs and sends notifications on activity
panel_custom:  # This is the custom gui panel
    - name: locks
      sidebar_title: ZWave Locks
      sidebar_icon: mdi:lock

And an obligatory screen cap:

1 Like

@drytoastman, quick question. You have a different lock model than I (I have the FE599) but I am going to work from the assumption that perhaps the locks being from the same company, the firmware may not be all that different. I may be incredibly off base there, but hey, I will give it a shot and see.

That said, will this read the codes that are already in the lock? Or do I just need to factory reset the lock and start over when I pair it to HA?

As far as I know, Schalge, even now, only returns ‘**********’ when requesting the lock code. I only do the request to see if something at the given index has a value assigned or not (free to assign to new code, not overwrite)

However, when you first use things, my stuff should assign ‘Unassigned Code #’ to any unknown entries. You can then use the “Rename” action in the frontend to change the code name, assuming that the code is in the same index on every lock. The other option is to clear the locks and start fresh.

Man this is what I’ve been looking for before being able to switch completely off my Staples Connect (ugggg that platform was frustratingly easy to use but so limited…).

I’d certainly vote for this to be added as a Component of Some sort . . . or a Z-Wave Lock component enhancement or something! It’s really a great first try at getting this feature in HomeAssistant!

I got it running on my HomeAssistant instance fine . . . after I brushed up on the “custom component” stuff which I didn’t even know existed – Nice feature for custom development! And, then I put in fresh batteries for my Lock and that really helped when it tried to read the Lock data.

@drytoastman can you provide some more info. on how to get the code clearing capability working? Do you know if/when your pull request/recommendation might be available as part of Openzwave or an Home Assistant update? Or is it best that I manually pull your version from git and try to get that working in my instance? Any more details would be most helpful.

Also, do you know if this works with a 6digit code if that is enabled on the Lock? It seemed to have issues until I disabled and went back to 4 digit code.

I was gone for while. The component has been updated for 0.49. I think its pretty much specific to my old lock which doesn’t follow any of the current standards. i.e. you can’t request codes, only set them, so I have to resort to ugliness to get the Available/NotAvailable code for each code location.

I changed the hass component name to locksinterface and tried to use as much of the new zwave lock features that have appeared. Basically, I’m just adding a name to code location mapping and storing that in a local file. Config looks like:

  - name: locks
    sidebar_title: ZWave Locks
    sidebar_icon: mdi:lock

@drytoastman where is your python script for setting user codes? Has it moved? I could not find it under your GitHub account.

Its call now hence the config change.

1 Like

got it @drytoastman. sorry I actually just saw it like moments ago after looking at your code more closely. Will this work on all Schlage locks?

Not sure. The newer locks may follow standards where as the old locks didn’t have many standards to follow.

Also note, I deleted my old repo (long story). The new stuff is in under the hass directory.

anyone having issues with this script after upgrading to 0.51.2? I seem to not be able to delete a user.

Just got all this up and running. Great job with the code! The only thing that doesn’t work for me is deleting a user code. It goes through the process like it is doing it by adding the (-) sign in front of the name and then it goes away but the name stays and the code still works. If I go into the programing mode on the lock and remove that code it disappears from the list on HASS. Any ideas on how to get it to delete a user code through the web interface on HASS?

I can’t speak to any newer locks but I had to apply a patch to openzwave to get deleting to work for me. I had submitted a patch some time ago but they were still working out how they wanted to implement it for all users. I recently added a change to allow the clearing command from hass (uses as many 0 bytes as the code size) to work as well.

Checkout the changes to the file UserCode.cpp at github. Specifically #9bc8fc5 and #cc0b400.

@drytoastman any idea on how to make your locks interface work with

I have 2 Schlage BE369 locks. One of them is paired to a Vera 2 which emails me when a user activates it. The other lock is paired to an Aeotec Z-Stick Gen 5 plugged into a Raspberry Pi running Home Assistant. I want Home Assistant to send me user activation emails like the Vera does. It looked like Drytoastman’s custom component might help me but it no longer exists on github. Is still around?

hmm this doesn’t seem to work anymore i get the below error

Line 45664: 2018-06-04 12:35:38 ERROR (MainThread) [homeassistant.components.panel_custom] Unable to find webcomponent for locks: /root/.homeassistant/panels/locks.html
Line 50089: 2018-06-04 12:47:24 ERROR (MainThread) [homeassistant.components.panel_custom] Unable to find webcomponent for locks: /root/.homeassistant/panels/locks.html

I do have the locks.html file in that folder