Zwave Lock Manager

I came home and tested temp config and it worked. I will say that I have never officially used the single lock package. I just took my three lock package and cleaned it up to make it easier for others, maybe there is a typo?

Either way, this is the exact code I’m using for my three locks and it works

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

Have a look at the sections where it clears and make sure its set up correctly.

Can anyone tell me if anyone has looked at forking this project to support ZigBee locks? Or is there an alternative project?

I have a Kwikset ZigBee model and it’s the main thing preventing me from migrating away from Smartthings.

I know ZWave is popular in the US but most hardware is not legal to use in Australia because if the frequency used.

I’m sure if you adapted the service calls to use the zigbee commands to set/clear codes it’d work mostly fine.

1 Like

I wasn’t able to do this last night but tonight I will check this out and see if I can get it to work. Thanks again for all of your help!

I have been using your lock package for a few weeks and I greatly appreciate it. I recently created a Node-Red Automation to announce a welcome message to the user who unlocks the front door based on the sensor.frontdoor_code. The problem I’m having is the sensor is reporting the wrong user code in my automation because it quickly switches from the correct user back to user 1. User code 1 is called “Nick” in my setup. When User code 4 “Peter” opens the door, the sensor briefly changes to Peter and within seconds it immediately changes back to “Nick” This doesn’t happen all the time but it happens most of the time. Reboots don’t seem to help. This messes up my Node-Red Automation because its based on a change-state trigger and it changes my welcome message to “Welcome Home, Nick” most of the time for all users. I have a few Ideas on how to work around this but am curious if anyone knows how to fix it to make it work properly. The following is the excerpt from the code I’m using.

frontdoor_code:
        friendly_name: 'Last Person to unlock with Keypad (Front Door)'
        value_template: >
          {% set number = states('sensor.lock_front_door_deadbolt_alarm_level') %}
          {% set entity_id = 'input_text.door_keypad_' + number + '_name' %}
          {% set user = 'Master' if number == '0' else states(entity_id) %}
          {{ user }}

What kind of lock do you have? I’m going to guess an FE599?

My front door lock is a BE469 but I do have a FE599GR somewhere else. Did I mess something up?

I don’t think you messed anything up. :slight_smile:
The fe599 is just a weird lock. The issue you described sounds like what I occasionally see with the fe599

I just looked at my lock and I don’t have the behavior you described with be two be469’s

So do you find the sensor changing as well

image
I found this in my logs and also the sensor.frontdoor_code isn’t updating anymore either (since yesterday). Rebooting HomeAssistant does not fix it either.

So I took the code you posted here you said you were using for 3 locks and removed all of the references to the 2nd and 3rd locks and I still have the same issue. The clear code button looks like it is clearing codes but they stay in the lock. What version of Home Assistant are you running? I’ve been keeping mine current so maybe the newer versions have an issue?

Also, I have the same issue as @JrPickle where the name under the Last Person to Unlock changes to correct information for like a second before changing back to either Master or the name of the Code 1 slot.

My lock is the BE469 in case it makes a difference.

Sorry for the late replies, its been a long weekend. :slight_smile:
So, I also have have a be469 (two actually) and am running 91.4. I tested the clear code again where a random number is set and it does seem to be working. So couple more quick questions, and you’ve probably already answered above so sorry if I’m asking again.

You are able to set the usercodes, and even change the user code using the lock package? I get that the codes clear from the input number when the time/day happens, just not clearing from the lock itself.

As far as the last person to unlock, I’ve tried that too and it also seems to be working. So the last person to unlock is really just a friendly name for the value from

sensor.lock_front_door_deadbolt_alarm_level

or whatever your lock name is. The sensor has nothing to do with the package. So, when you unlock the door you should see that value change to the slot # of the code used to unlock the door. Is it changing back to zero (aka master) or to slot 1 by itself?

Edit: I take it back, it did change back to slot one. But I realized it did not change for 17 minutes. It did not change when I locked it using HA, but it did change when I unlocked it manually after that. Can you confirm this is what happens to you.

Unlock the door and check the last person to unlock. Wait for 5-10 minutes, and leave the door alone. I suspect it will still be whoever unlocked it. Then lock it with HA (or also try locking manually), check the sensor state again.

Basically lets figure out which combinations cause the sensor to change back to 1 or 0, and we can get the logic for that.

Edit 2: Ive confirmed that at least for me locking the door manually with the turn key sets the sensor back to 1.

I’ll have to do some tweaking or if anyone else wants to. I’m a bit busy at the moment, but this is the code

      frontdoor_code:
        friendly_name: 'Last Person to unlock with Keypad (Front Door)'
        value_template: >
          {% set number = states('sensor.lock_front_door_deadbolt_alarm_level') %}
          {% set entity_id = 'input_text.door_keypad_' + number + '_name' %}
          {% set user = 'Master' if number == '0' else states(entity_id) %}
          {{ user }}

need to set some logic to not change the user if the last lock action was manual lock
That can get gotten from here - sensor.front_door_report or probably from the lock itself.

Thanks for the reply. I can set user codes from your interface and I believe (I will double check tonight) I can change codes but if I click the Execute button to clear a code, the code stays in the lock. At the end of the day I can just change the code to something else random myself but now this is just a problem I want to solve more than anything else.

Over the weekend I actually removed the lock from home assistant, removed your package and associated entities and factory reset the lock. I then added it back to Home Assistant to see if that would help but I still have the same problem.

I set my lock up as a Secure Node. Is there a problem with me doing that?

I will defintiely have a look at the last person to unlock logic. It was written quite a while ago, at that time the locks often did not report correct status when they were unlocked or locked using Home assistant. I believe that most of that has been fixed in the past several months.

Anyway, using different setup I believe we could easily just use the lock status as a trigger in an automation vs a sensor.
So

node_id: 104
value_index: 0
value_instance: 1
value_id: 72057595788558336
notification: Keypad Unlock
lock_status: Unlocked with Keypad by user 2
friendly_name: Front Door Lock

Use Keypad unlock as a trigger, and the same value template

        value_template: >
          {% set number = states('sensor.lock_front_door_deadbolt_alarm_level') %}
          {% set entity_id = 'input_text.door_keypad_' + number + '_name' %}
          {% set user = 'Master' if number == '0' else states(entity_id) %}
          {{ user }}

to set the value of an input_text named frontdoor_code.

Somthing like that should do the trick and would only change the name if the door was unlocked with a code

Secure node is the way to go. I’m sure there is just a naming issue with a sensor or something. Can you put the names of all of the sensors created when you added your lock. Should be 7 I believe.

sensor.lock_front_door_deadbolt_alarm_level
sensor.lock_front_door_deadbolt_alarm_type
lock.lock_front_door_lock
sensor.schlage_allegion_be469_touchscreen_deadbolt_access_control
sensor.schlage_allegion_be469_touchscreen_deadbolt_burglar
sensor.schlage_allegion_be469_touchscreen_deadbolt_power_management
sensor.schlage_allegion_be469_touchscreen_deadbolt_sourcenodeid
sensor.schlage_allegion_be469_touchscreen_deadbolt_system

The zwave entity is zwave.lock_front_door_deadbolt

I renamed the stuff mentioned at the top of your code. Was I supposed to do the other stuff too?

Nope, this all looks good to me, you dont have to rename the other sensors. So lets start with this, since there are a few areas in the code that “clear” the code.

Pick a slot (could be new, or unused)
Make sure it’s set to always
If the switch is on, turn it off and wait about a minute.

Check to see if the code for that slot is still working.
If it does work, check the sensor to make 100% sure it’s actually the same slot, and not another slot that maybe had that code used before.

Remember that HA has no real idea what slots are programed, etc. You could have programmed a code manually before ever using HA. I know I did. But it will know which user slot was used to unlock the door.

Ok, next. If the slot is in fact the same slot that you just turned off the switch, go ahead and enter a new code, make sure its set to always, and then turn the switch for the door back on. Give it a minute. Does the new code work, does HA show the slot that you just set the code as the same slot. Now for fun, try the old code. Does it still work? If so does it show a different slot now?

I belive that the BE469 can store the same code is multiple slots.

This should be a good starting point

I have not completed this in my package, but tested in my template editor

Basically this should work for last user to friendly name

- alias: Set Last Person to unlock with Keypad (Front Door)
  trigger:
  - platform: template
    value_template: "{{ states.lock.lock_front_door_lock.attributes.notification == 'Keypad Unlock' }}"
  action:
  - service: input_text.set_value
    data_template:
      entity_id: input_text.frontdoor_code
      value_template: >
        {% set number = states('sensor.lock_front_door_deadbolt_alarm_level') %}
        {% set entity_id = 'input_text.door_keypad_' + number + '_name' %}
        {% set user = 'Master' if number == '0' else states(entity_id) %}
        {{ user }}

Basically this automation will only trigger when the door lock changes to unlocked with code. The only “issue” ive seen is if you’re locking, unlocking, entering code, then locking, etc. quickly. Basically when you’re testing, give yourself a couple seconds between actions. Overall I think that this should be pretty solid. I dont think you could “unlock” the door with two different codes unless you locked it somehow between users. So the last user input text will only be updated based on door unlocked with code

If you want to test this, you’ll have to create the input text.

I have two codes set to always in slot 1 and 2 those work fine. Slot 3 I turn on and off based on workers coming to my house. I set a code in slot 3 and it works. I clear the code and it does not clear. However, if I set a different code in slot 3 the original slot 3 code stops working and only the new code I just set works.

If I clear code 3 and try it again it still works. On the notification I set up when the door unlocks, it shows that it was unlocked by code 3 but leaves the name blank as it is blank in the UI.

Now if I go to the Z-Wave interface and check out my lock I can see the Node user codes. It shows codes 1, 2 and 3 all as “\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a\x2a” and everything else as “\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00”

If I click Delete Usercode from the Z-Wave menu it also does not seem to change it. I’m assuming that is because of the openzwave issue and I am still using the openzwave that comes with Home Assistant instead of the forked one. Or am I totally incorrect and this is a symptom of another problem?

I can confirm this. If you have no automation’s in your automation file then it will give an error. Add any automation to your automation file and the error goes away.

My log warning the other day was actually because the lock batteries were too low (found out when it wouldn’t lock by itself anymore). After I swapped the door it reported its settings and states with Home Assistant. I can confirm that locking the door with the turn key resulted in it thinking User Code 1 was triggered. I have added your automation and created the input text but the sensor.frontdoor_code still switches to User Code 1 when locking with the turn key. Other than that everything is good. Do I need to change sensor.frontdoor_code in anyway? It doesn’t appear to be even used in your automation.