KeyMaster Z-Wave lock manager and scheduler

#1. Check your home-assistant.log for error messages
#2. The scripts can be regenerated using keymaster service for generating the files:

You need to change the HA setting to make entities persistent

Here are the errors iā€™m getting when the user code is used

2021-08-20 18:21:13 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'event' when rendering '{{ trigger.event.data.action_text }} {% if trigger.event.data.code_slot > 0 %}({{ trigger.event.data.code_slot_name }}){% endif %}'

2021-08-20 18:21:13 ERROR (MainThread) [homeassistant.components.automation.keymaster_front_door_lock_notifications] keymaster_front_door Lock Notifications: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'dict object' has no attribute 'event'

2021-08-20 18:21:13 ERROR (MainThread) [homeassistant.components.automation.keymaster_front_door_lock_notifications] Error while executing automation automation.keymaster_front_door_lock_notifications: Error rendering data template: UndefinedError: 'dict object' has no attribute 'event'

I had significant issues with 3 Schlage 469 locks not fully including on the Zwave Mesh Network (currently ~70 devices). Due to this, Keymaster was having issues communicating with them and at some point reporting them as Disconnected. I had to remove the locks and therefore Keymaster a few times and ended up not being able to install it again due to some ā€œit is already there errorā€.

I deleted the HACS integration, I uninstalled the Keymaster Integration for all locks, I deleted the keymaster folder and then I had to manually delete a ton of Entities created by Keymaster. Was that all I needed to do for a clean slate? I am new to HASS to guidance would be much appreciated.

Is there a way to mark the entities with ā€œKeymasterā€ as the integration so that it is super clear what needs to be nuked? For the most part it was obvious, but it would be a nice touch.

When I got back up and running, I found that it was helpful to add a person/code and wait for the system to propagate it to the locks, then do the next. I had 4 out of 6 created that I needed to enter and doing it slowly seemed to help, or maybe it was a coincidence (ie my network was calm).

Some of my issues appear to have been caused by me moving the HASS RPI back to its normal location thus causing the locks to lose their connection to the zwave controller (had to move it right next to the locks for them to pair). I ran a network heal after pairing the locks leaving the RPI near the locks, I am planning on moving the RPI upstairs (further away) but still closer to the locks and running another. If that works, I will then try to move it back to the other side of the house where the RPI normally is and run another.

Is this a good plan to ensure the locks retain a connection? I would really love not to start over for the n-th time.

Thank you for the awesome integration.

If youā€™re having connectivity issues to the locks then you probably need a ZWave repeater between your desired RPi location and the locks. Any always powered device (not battery powered) should do the trick. So, a ZWave enabled power socket, or light switch somewhere in between locations.

My home setup is a mix of bot Zigbee and ZWave devices. Iā€™ve purposely sprinkled fully powered devices around to make sure that my edge devices all have a route back to wherever I keep my HA.

1 Like

@tykeal - I have about 72 Zwave devices and the majority are hard wired (switches, dimmers mostly). I also had outlets but I am replacing those with Zigbee variants to reduce the number of devices on the Zwave mesh network. When I was on the ST platform, ST engineers always told me my network had excessive traffic so I have since been working on toning it down as much as possible by changing reporting settings and reducing devices to spread the load to Zigbee (which has always been way more reliable and faster for me).

When looking at the logs while I was fighting with the 3 locks, I noticed that the node trying to communicate with the lock I was working on was another lock, and not one of the hardwired zwave plus nodes next to the lock torturing me.

I thought battery operated devices would never route messages but the logs seem to show otherwise. I also saw the lock reported itself as a ā€œrouter slaveā€ so I figured there were corner cases where these secure devices would ā€˜help each otherā€™.

Interesting, I was under the impression that battery devices wouldnā€™t advertise as routers at all. I initially had some issues with some interference / distance and just made sure to get a few wired devices in place and it resolve my issue.

Admittedly, Iā€™m not running nearly that many devices even if I combine both of my meshes!

Battery operated devices do not route. Iā€™d be interested in seeing these logs with your lock routing messages.

@firstof9 - How do I retrieve them?

If I recall correctly I saw the lock was a Routing Slave when I was re-interviewing it due to an incomplete inclusion. This attribute is also shown on the Zwave Alliance page:

Based on a table in this document, it would appear that a Routing Slave ā€œCan reply to the node which he has received the message from and can send unsolicited messages to a number of predefined nodes he has a route tooā€

When I looked at the logs during one of my many attempts to get the locks to include properly, I saw a node other than the controller was communicating with my lock so I looked it up, and it was my Patio Door Lock.

I could try re-interviewing the lock to see what the log shows but given the hell I went through, I will refrain until I have to.

A battery powered node only consumes, they donā€™t participate in the mesh.

Agreed, they donā€™t participate in the mesh, but apparently they ā€œcan send unsolicited messages to a number of predefined nodes he has a route toā€. Maybe that was what I sawā€¦

That just means they can send reports like temp, lux, humidity, etc when not requested.

1 Like

Are you using the zwavejsmqtt addon? Be aware the network graph there is totally wrong. Please ignore it. Mine shows crazy things like zwave devices routing through locks and bogus peer data. Just ignore it completely.

@fresnoboy - No I am just using the regular ZWave JS integration. I was watching the zwave logs while I was trying to recover one of my locks and the node pinging it was another lock which struck me as odd. I thought I had saved a dump of the log but canā€™t find itā€¦ but it just occurred to me I was on my laptop. Iā€™ll look there and post it here if I happen to have captured it.

I used keymaster quite awhile ago, successfully, to add my ā€œownerā€ door codes for two doors. Iā€™m trying now to add a couple of guest codes, and they are stuck on ā€œconnecting.ā€

Iā€™ve attempted to run the service to initialize the package for each door, but I get a ā€œfail to call service.ā€

Integration

I notice that my keymaster_common.yaml file is generic:

</s> <s>input_boolean:</s> <s> LOCKNAME_lock_notifications:</s> <s> name: CASE_LOCK_NAME Lock Notifications</s> <s> LOCKNAME_dooraccess_notifications:</s> <s> name: CASE_LOCK_NAME Door Notifications</s> <s> LOCKNAME_garageacess_notifications:</s> <s> name: CASE_LOCK_NAME Garage Notifications</s> <s> LOCKNAME_reset_lock:</s> <s> name: CASE_LOCK_NAME reset lock</s> <s> keymaster_LOCKNAME_autolock:</s> <s> name: 'Auto Lock Enabled'</s> <s> icon: mdi:key-remove</s> <s>
ā€¦and I canā€™t remember if thatā€™s supposed to auto-populate with my lock names or not.

At any rate, I canā€™t make any changes to codes as is. Should I remove and reinstall, or is there an easier fix? Iā€™m running HA supervised and installed through HACS. The keymaster integration version is 0.0.62 as of this morning.

Iā€™m running ZwaveJS to MQTT and I have folders for both of my named locks in \config\packages\keymaster.

EDIT 1: I just successfully added and removed a PIN to the other door! So why would ā€œgaragedoorā€ work when ā€œfrontdoorā€ does not? Both are alive and well in ZwaveJS to MQTT, device nos are consecutive.

Relevant logs:

Error while executing automation automation.garagedoor_lock_notifications: Unable to find service script.garagedoor_manual_notify
11:26:24 AM ā€“ (ERROR) Automation - message first occurred at 11:25:49 AM and shows up 4 times
garagedoor Lock Notifications: Error executing script. Service not found for call_service at pos 1: Unable to find service script.garagedoor_manual_notify
11:26:24 AM ā€“ (ERROR) Automation - message first occurred at 11:25:49 AM and shows up 4 times
The 'entity_id' option near /config/packages/outdoor_motion_sensor.yaml:32 is deprecated, please remove it from your configuration
11:18:01 AM ā€“ (WARNING) Template - message first occurred at 8:16:33 AM and shows up 6 times
YAML file /config/themes.yaml contains duplicate key "Dark - Green". Check lines 0 and 397
11:18:00 AM ā€“ (WARNING) util/yaml/loader.py - message first occurred at 11:15:58 AM and shows up 2 times
10.0.0.29: Connection timed out for hub 17491758
11:13:00 AM ā€“ (ERROR) /usr/local/lib/python3.9/site-packages/aioharmony/hubconnector_websocket.py - message first occurred at 9:57:46 AM and shows up 2 times
[140178715964560] Error handling message: Unknown error
11:11:31 AM ā€“ (ERROR) Home Assistant WebSocket API (custom integration) - message first occurred at 11:06:10 AM and shows up 4 times
**websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Couldn't find existing lock entry for FrontDoor**
**11:11:31 AM ā€“ (ERROR) keymaster (custom integration) - message first occurred at 11:06:10 AM and shows up 4 times**
https://10.0.0.57:8123/lovelace-home/entry:0:0 Uncaught
11:05:22 AM ā€“ (ERROR) components/system_log/__init__.py - message first occurred at 10:35:11 AM and shows up 2 times
Error while executing automation automation.frontdoor_lock_notifications: Unable to find service script.frontdoor_manual_notify
10:54:07 AM ā€“ (ERROR) Automation - message first occurred at 9:57:00 AM and shows up 3 times
frontdoor Lock Notifications: Error executing script. Service not found for call_service at pos 1: Unable to find service script.frontdoor_manual_notify
10:54:07 AM ā€“ (ERROR) Automation - message first occurred at 9:57:00 AM and shows up 3 times

EDIT 2: Iā€™ve been able to regenerate packages for both locks through the integration: adding and removing slots. However, the front door lock is still stuck on ā€œaddingā€ (now ā€˜addingā€™ instead of ā€˜connectingā€™, I suppose since the packages are updated). The only difference between the two locks that I can find is that slot 6 of FrontDoor is unavailableā€¦ and Iā€™ve removed it (by reducing to 5 slots) and readded it a few times:

Iā€™m stuck.

Wow this is amazing. Nice work @FutureTense and contributors.

Question I didnā€™t see an answer to, does this app prevent the lock from being locked while the corresponding door sensor is in an open state? Seemed like in testing I could get an accidental locking while the door was open and it wouldnā€™t close it. I have an automation already set up to unlock it if door is open and it locks, but wondering if I should keep my automation on?

If itā€™s unavailable thatā€™s usually because the User Code CC hasnā€™t fully populated.

Yeah, but it was days/weeks. Iā€™ve deleted the integration, excluded and factory reset the lock, re-included, and then re-installed the integration. I then added the locks back to Lovelace andā€¦ same issue. PINs are still hung up on ā€˜addingā€™ or, now, ā€˜deletingā€™.

EDIT: This is working now. I went through both locks in the Zwave to MQTT UI, marked all code slots as ā€œavailableā€ to clear them out, deleted the keymaster integrations, restarted HA, then re-installed the integrations and the Lovelace views. Maybe there was some conflict with codes being loaded somewhereā€¦ but it looks like everything works now? Whatā€™s odd is that even after a factory reset, clearing codes at the locks, and deleting the integration (plus verifying everything was gone from /packages), I still didnā€™t need to rekey my codes; they were already there in the Lovelace view.

If I recall they get restored from HAā€™s internal processes.

I recently switched from the official Zwave JS to Zwave2MQTT add-on. I am not using it only for a control panel. All of my lights and locks are connect and work when I send a command. I still have the official Zwave JS add-on installed but it is not started.
Iā€™ve been having a problem with KeyMaster for some time now. Some locks would be stuck at deleting or adding. So I uninstalled the integrations for the locks and KeyMaster from HACS. Rebooted HA. I installed Keymaster in HACS and added an integration for one of my locks. Thatā€™s when I noticed my logs have an error stating Z-wave integration cannot be found.

This error originated from a custom integration.

Logger: custom_components.keymaster.binary_sensor
Source: custom_components/keymaster/binary_sensor.py:88
Integration: keymaster (documentation, issues)
First occurred: 5:17:11 PM (7 occurrences)
Last logged: 5:27:16 PM

Z-Wave integration not found

Do I need to start the official Zwave-JS add-on? Shouldnā€™t KeyMaster use the Zwave2MQTT add-on?

I also have this error message in my logs but I am guessing when I get the Zwave error fixed, this one will go away.

This error originated from a custom integration.

Logger: custom_components.keymaster
Source: helpers/update_coordinator.py:219
Integration: keymaster (documentation, issues)
First occurred: 5:17:11 PM (1 occurrences)
Last logged: 5:17:11 PM

Error fetching keymaster data: