The fix is actually not mine, it’s another openzwave PR from a while ago that never got merged, apparently there is not a full agreement that the approach is the best way to handle the clearing. I’m no programer, but it worked for me. I suspect that the issue is that it has the potetial to cause other issues.
Shame… currently struggling to even get the dummy code to set correctly
Right, it looks like my lock (a KeyWe) will not accept duplicate codes. Which means that it fails to overwrite a code if the the code I want to overwrite it with already exists in a different slot.
Looks like delete_usercode results in “0000” being a valid code (I can’t have that happen!) and since I don;t feel like having random codes enabled in random places, it looks like I am stuck at the moment. Shame. I really liked what you had done and was hoping I could use it for my needs (setting up weekly recurring code without asking the guests to install the BS propriatery app)
Anyone know if we might hope for OpenZWave to ever be fixed?
That is good info. Sorry that sucks. If you’re good at branching, you could pull down the current OWZ used by HA, and add the updated door lock code where 0000 works.
This is the code I’m using where 0000 works (at least with my schlages)
There is a lot of info on this post about how best to do that
Until the last version of HA, many of us (those with the linear garage door opener), had to do this to add cover support, and I just added the lock updates to my branch as well.
Of course now with the new fork of OWZ for HA being seperate, the soruce location, has changed.
I just ran across this after installing my smartcode 916 deadbolt. I am certainly going to be installing it asap as it adds the exact functionality I am looking for! Will report back soon.
Here is some lovelace for the door codes UI. I’m using the swiper card at the moment. I’m still new to this so not sure if I need to remove the groups, etc from the package. For now I’ll leave them there to offer backwards compatability.
This uses the swiper card more info on how to set that up here
cards:
- cards:
- content: |
## Door Lock Info
The first few cards show the door reports
## Code Management
The next cards are for user code slot management
Codes 1-10 are for Family Members
Codes 11-15 are for Workers
Codes 16-18 are one time use slots
## The last few cards are for Z-Wave options
type: markdown
- entities:
- lock.lock_front_door_lock
- sensor.front_door_report
- sensor.frontdoor_code
title: Front Door Info
type: entities
show_header_toggle: false
- entities:
- lock.lock_back_door_lock
- sensor.back_door_report
- sensor.backdoor_code
title: Back Door Info
type: entities
show_header_toggle: false
- entities:
- lock.lock_garage_door_lock
- sensor.garage_door_report
- sensor.garagedoor_code
title: Garage Door Info
type: entities
- entities:
- input_text.door_keypad_1_name
- input_text.door_keypad_1_code
- input_select.door_keypad_1_access_schedule
- input_datetime.door_keypad_1_date_start
- input_datetime.door_keypad_1_date_end
- input_boolean.door_keypad_1_front_switch
- input_boolean.door_keypad_1_back_switch
- input_boolean.door_keypad_1_garage_switch
- script.door_keypad_1_delete
title: Entry Code 1
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_2_name
- input_text.door_keypad_2_code
- input_select.door_keypad_2_access_schedule
- input_datetime.door_keypad_2_date_start
- input_datetime.door_keypad_2_date_end
- input_boolean.door_keypad_2_front_switch
- input_boolean.door_keypad_2_back_switch
- input_boolean.door_keypad_2_garage_switch
- script.door_keypad_2_delete
title: Entry Code 2
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_3_name
- input_text.door_keypad_3_code
- input_select.door_keypad_3_access_schedule
- input_datetime.door_keypad_3_date_start
- input_datetime.door_keypad_3_date_end
- input_boolean.door_keypad_3_front_switch
- input_boolean.door_keypad_3_back_switch
- input_boolean.door_keypad_3_garage_switch
- script.door_keypad_3_delete
title: Entry Code 3
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_4_name
- input_text.door_keypad_4_code
- input_select.door_keypad_4_access_schedule
- input_datetime.door_keypad_4_date_start
- input_datetime.door_keypad_4_date_end
- input_boolean.door_keypad_4_front_switch
- input_boolean.door_keypad_4_back_switch
- input_boolean.door_keypad_4_garage_switch
- script.door_keypad_4_delete
title: Entry Code 4
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_5_name
- input_text.door_keypad_5_code
- input_select.door_keypad_5_access_schedule
- input_datetime.door_keypad_5_date_start
- input_datetime.door_keypad_5_date_end
- input_boolean.door_keypad_5_front_switch
- input_boolean.door_keypad_5_back_switch
- input_boolean.door_keypad_5_garage_switch
- script.door_keypad_5_delete
title: Entry Code 5
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_6_name
- input_text.door_keypad_6_code
- input_select.door_keypad_6_access_schedule
- input_datetime.door_keypad_6_date_start
- input_datetime.door_keypad_6_date_end
- input_boolean.door_keypad_6_front_switch
- input_boolean.door_keypad_6_back_switch
- input_boolean.door_keypad_6_garage_switch
- script.door_keypad_6_delete
title: Entry Code 6
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_7_name
- input_text.door_keypad_7_code
- input_select.door_keypad_7_access_schedule
- input_datetime.door_keypad_7_date_start
- input_datetime.door_keypad_7_date_end
- input_boolean.door_keypad_7_front_switch
- input_boolean.door_keypad_7_back_switch
- input_boolean.door_keypad_7_garage_switch
- script.door_keypad_7_delete
title: Entry Code 7
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_8_name
- input_text.door_keypad_8_code
- input_select.door_keypad_8_access_schedule
- input_datetime.door_keypad_8_date_start
- input_datetime.door_keypad_8_date_end
- input_boolean.door_keypad_8_front_switch
- input_boolean.door_keypad_8_back_switch
- input_boolean.door_keypad_8_garage_switch
- script.door_keypad_8_delete
title: Entry Code 8
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_9_name
- input_text.door_keypad_9_code
- input_select.door_keypad_9_access_schedule
- input_datetime.door_keypad_9_date_start
- input_datetime.door_keypad_9_date_end
- input_boolean.door_keypad_9_front_switch
- input_boolean.door_keypad_9_back_switch
- input_boolean.door_keypad_9_garage_switch
- script.door_keypad_9_delete
title: Entry Code 9
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_10_name
- input_text.door_keypad_10_code
- input_select.door_keypad_10_access_schedule
- input_datetime.door_keypad_10_date_start
- input_datetime.door_keypad_10_date_end
- input_boolean.door_keypad_10_front_switch
- input_boolean.door_keypad_10_back_switch
- input_boolean.door_keypad_10_garage_switch
- script.door_keypad_10_delete
title: Entry Code 10
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_11_name
- input_text.door_keypad_11_code
- input_select.door_keypad_11_access_schedule
- input_datetime.door_keypad_11_date_start
- input_datetime.door_keypad_11_date_end
- input_boolean.door_keypad_11_front_switch
- input_boolean.door_keypad_11_back_switch
- input_boolean.door_keypad_11_garage_switch
- script.door_keypad_11_delete
title: Entry Code 11
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_12_name
- input_text.door_keypad_12_code
- input_select.door_keypad_12_access_schedule
- input_datetime.door_keypad_12_date_start
- input_datetime.door_keypad_12_date_end
- input_boolean.door_keypad_12_front_switch
- input_boolean.door_keypad_12_back_switch
- input_boolean.door_keypad_12_garage_switch
- script.door_keypad_12_delete
title: Entry Code 12
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_13_name
- input_text.door_keypad_13_code
- input_select.door_keypad_13_access_schedule
- input_datetime.door_keypad_13_date_start
- input_datetime.door_keypad_13_date_end
- input_boolean.door_keypad_13_front_switch
- input_boolean.door_keypad_13_back_switch
- input_boolean.door_keypad_13_garage_switch
- script.door_keypad_13_delete
title: Entry Code 13
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_14_name
- input_text.door_keypad_14_code
- input_select.door_keypad_14_access_schedule
- input_datetime.door_keypad_14_date_start
- input_datetime.door_keypad_14_date_end
- input_boolean.door_keypad_14_front_switch
- input_boolean.door_keypad_14_back_switch
- input_boolean.door_keypad_14_garage_switch
- script.door_keypad_14_delete
title: Entry Code 14
type: entities
show_header_toggle: false
- entities:
- input_text.door_keypad_15_name
- input_text.door_keypad_15_code
- input_select.door_keypad_15_access_schedule
- input_datetime.door_keypad_15_date_start
- input_datetime.door_keypad_15_date_end
- input_boolean.door_keypad_15_front_switch
- input_boolean.door_keypad_15_back_switch
- input_boolean.door_keypad_15_garage_switch
- script.door_keypad_15_delete
title: Entry Code 15
type: entities
show_header_toggle: false
- entities:
- input_select.door_keypad_16_access_schedule
- input_text.door_keypad_16_name
- input_text.door_keypad_16_code
- input_boolean.door_keypad_16_front_switch
- input_boolean.door_keypad_16_back_switch
- input_boolean.door_keypad_16_garage_switch
- script.door_keypad_16_delete
title: One Time Use Code 1
type: entities
show_header_toggle: false
- entities:
- input_select.door_keypad_17_access_schedule
- input_text.door_keypad_17_name
- input_text.door_keypad_17_code
- input_boolean.door_keypad_17_front_switch
- input_boolean.door_keypad_17_back_switch
- input_boolean.door_keypad_17_garage_switch
- script.door_keypad_17_delete
title: One Time Use Code 2
type: entities
show_header_toggle: false
- entities:
- input_select.door_keypad_18_access_schedule
- input_text.door_keypad_18_name
- input_text.door_keypad_18_code
- input_boolean.door_keypad_18_front_switch
- input_boolean.door_keypad_18_back_switch
- input_boolean.door_keypad_18_garage_switch
- script.door_keypad_18_delete
title: One Time Use Code 3
type: entities
show_header_toggle: false
- entities:
- input_select.lock_zwave_option_3_front
- input_select.lock_zwave_option_4_front
- input_select.lock_zwave_option_5_front
- input_select.lock_zwave_option_7_front
- input_select.lock_zwave_option_8_front
- input_select.lock_zwave_option_9_front
- input_select.lock_zwave_option_10_front
- input_select.lock_zwave_option_11_front
- input_select.lock_zwave_option_15_front
- input_select.lock_zwave_option_16_front
title: Front Door Configuration Options
type: entities
show_header_toggle: false
- entities:
- input_select.lock_zwave_option_3_back
- input_select.lock_zwave_option_4_back
- input_select.lock_zwave_option_5_back
- input_select.lock_zwave_option_7_back
- input_select.lock_zwave_option_8_back
- input_select.lock_zwave_option_9_back
- input_select.lock_zwave_option_10_back
- input_select.lock_zwave_option_11_back
- input_select.lock_zwave_option_15_back
- input_select.lock_zwave_option_16_back
title: Back Door Configuration Options
type: entities
show_header_toggle: false
parameters:
spaceBetween: 8
scrollbar:
hide: false
draggable: true
snapOnRelease: true
type: 'custom:swipe-card'
type: horizontal-stack
How’d you update your openzwave? I saw you mentioned it in your delete comments.
Back before the Garage Door opener (cover) I am using was fully supported updating zwave was a common thing for a small group of HA users.
Basically, I have a fork of the HA open-zwave, I manually updated the usercode.cpp file, I then install that version in my HA instance. It’s actually kind of a pain, because I have to do this almost every time I update HA.
These are the basic steps to what you need to do
I forked the HA open-zwave
I then changed to the HASS branch and updated the usercode.cpp (I used the web GUI to do that)
If you dont want to do that you can use my fork
https://github.com/ptdalen/open-zwave
on my HA server
logged in with root user
systemctl stop [email protected]
sudo su -s /bin/bash homeassistant
You should already be in your home directory, but just in case
cd /home/homeassistant
git clone -b hass https://github.com/ptdalen/open-zwave (or use your own updated git fork)
source /srv/homeassistant/homeassistant_venv/bin/activate
export LOCAL_OPENZWAVE=/home/homeassistant/open-zwave/
pip uninstall -y homeassistant-pyozw==0.1.4 (or whatever the current version is)
pip install homeassistant-pyozw==0.1.4 --no-cache-dir --no-deps --install-option="--flavor=dev" (make sure to match the version of pyozw)
@ptdalen wanted to see if you had considered using variables for the door locks so that people wouldn’t have to rename a bunch of them through the code and instead do it once when defining a variable. Link: https://anil.io/blog/symfony/yaml/using-variables-in-yaml-files/
Also, any luck with getting your Lovelace UI integrated.
Love your work, thanks for all that you do!
I did consider variables a while ago, but now that is so easy to rename entities in the UI, I never went back to it. I did add lovelace code to my main lock package. it’s commented out since I dont think you can add lovelace in a package at this time. I need to update the other two packages, but just have not gotten around to it.
I will say that I am using this lovelace
with the swiper card, and I really like it. Mainly for me I dont change codes too much, and having the codes a few swipes away makes them a little less visible to users.
@ptdalen if my entity id for my lock is “lock.front_deadbolt”, how would I modify the following code so it matches my lock?
{% set lock_name = "_".join(object_id.split("_")[3:-1]) %}
{% set lock_id = 'lock_' ~ lock_name ~ '_door_lock' %}
{{ states['lock'][lock_id].attributes.node_id }}
I dont have a quick answer for you. I dont have access to the template test area at the moment.
My lock names were pretty much based on the naming convention that HA named them when I first started with HA several months ago.
If I was starting over I’d probably rename my locks something closer to what you have, but i have so many automation, scripts, sensors, etc now, I’ll probably not do that.
Ultimatlly the goal of the code
{% set lock_name = "_".join(object_id.split("_")[3:-1]) %}
{% set lock_id = 'lock_' ~ lock_name ~ '_door_lock' %}
{{ states['lock'][lock_id].attributes.node_id }}
is to get the zwave node ID of the lock, so lock_id needs to end up being front_deadbolt. If you only have one lock you could just set it as such
{% set lock_id = 'front_deadbolt' %}
This should work (might have to play with the quotes though) if you want to keep it open for multiple locks. Just make sure to get all the places.
{% set lock_id = "~ lock_name ~ '_deadbolt'" %}
@ptdalen I plan on having a separate .yaml for every lock to make it easier to navigate. My only issue with node ID is that since HA no longer names the entity cleanly like it used to, when I rename them, there is no longer a node ID to grab from the name. IS there a way to look up the node_if if its not in the name?
The Node_id is in the items attributes. (attributes.node_id)
So you end up with an entity that is your lock name, and it pulls the node_id from that.
And totally your call on having three separate packages, but the code will be 95% the same. So, you’ll end up with more lines of code to process in the long run. But probably talking miliseconds, so it probably makes no real difference.
ahhh excellent, many thanks!
I’ll add, that even though the naming convention for the locks may not be your preference, you’ll rarely ever deal with them. If you just change the names to match the code, it will take 5-10 minutes to set up all three locks in a single package.
@ptdalen have you tried adding/removing pin codes via HA’s OZW panel? Every time I try to do it manually it doesn’t work. Any ideas?
Yes, but you have to put it in ascii format
so for 1234
you’d enter
\x31\x32\x33\x34
I do that, but it just reverts back. However, the lock unlocks and locks no problem. All 4 of my locks are the same… any ideas?
ok never mind, I guess I was inpatient it works, just takes a bit