KeyMaster Z-Wave lock manager and scheduler

Hello, just recently I started getting an error ‘Service lock.lock not found.’ when trying to lock/unlock doors from a remote_homeassistant instance. The lock/unlock works from the HA instance that the locks are connected to.

Anyone else run into this that has a solution for?

So I know for keymaster we are kinda on our own for notifications, but Im hoping I can still get some help on this one. When I use the keypad to come home, it sends 3 msgs to my phone. Id like to see just the one with the username on it. Anyway to change this? I see up the script to point to my phone and all other notification settings are stock. Also unsure what ‘RF Unlock’ means. Thanks

Try settings these to “off”, like I have done.

image

Yes but I mean I want the notifications, I just dont want 3 of them for the same thing :slight_smile:

Yes these settings should do that.

Set these 2 to off (previous just the Lock one was on). Now getting no notifications. I believe i need to modify the code to tell it to not send certain types of notifications, I am just lost of where to find these. Also Id make my own but unsure how to pass the right parameters. Only one I really want is when keypad is used and the name of the user entering code. Thanks all

If you search this very, very long thread for lock_logging you’ll find a few posts about custom handlers for event changes. You can easily send a notification from that and disable the Keymaster built in notification system if it’s giving you issues.

2 Likes

Thank you sir, I will do that. Appreciate it!

Hola. So I got it working from your previous automation you mentioned in 2022. Generally working great. One thing (and my apologies I didnt go thru every single post just the first 4 or 5 you referenced the automation) but Im trying to exclude the notifications for ‘Manual lock operation’. Is there some mechanism to do this? Here is the automation I grabbed from ya with some slight tweaks to match my 3 locks and my phone. Thank you thank you!

alias: SS - Lock Logging
description: Custom Keymaster Notification
trigger:
  - platform: event
    event_type: keymaster_lock_state_changed
    event_data:
      state: unlocked
    variables:
      sn: |-
        {%- if trigger.event.data.code_slot_name == "" -%}
          Manual
        {%- else -%}
          {{ trigger.event.data.code_slot_name }}
        {%- endif -%}
      verb: |-
        {%- if trigger.event.data.code_slot_name == "" -%}
          unlock of
        {%- else -%}
          unlocked
        {%- endif -%}
      door: |-
        {%- if trigger.event.data.lockname == "front_door" -%}
          Front Door
        {%- elif trigger.event.data.lockname == "laundry_room" -%}
          Laundry Room Door
        {%- else -%}
          Garage Side Door
        {%- endif -%}
condition: []
action:
  - service: logbook.log
    data:
      name: "{{ trigger.event.data.lockname }}"
      entity_id: "{{ trigger.event.data.entity_id }}"
      message: "{{ sn }} {{ verb }} the {{ door }}"
  - service: notify.mobile_app_ss_s24u
    metadata: {}
    data:
      message: "{{ sn }} {{ verb }} the {{ door }}"
      title: "{{ door }}"
      data:
        tag: "{{ door }}"
mode: single

Yes, wrap the notify action into an if statement that is checking for sn != “Manual”

I have five Kwikset locks in Keymaster. I had to delete one (garage_1_entry) in Keymaster and re-pair it in Z-Wave JS. Adding it back into Keymaster generated some errors, shown in the photos. Did I miss something or should I have given it another name? One of the errors is asking if I want to override and migrate the entity, which I have not done as I await advice. Thank you.


Yes, wrap the notify action into an if statement that is checking for sn != “Manual”

My apologies for being such a newb but I am not familiar with that process/syntax. :frowning:

If you edit the notify service automation section in YAML mode then you can replace the notify service definition step with the following:

if:
  - condition: template
    value_template: "{%- if sn == 'Manual' -%}True{%- else -%}False{%- endif -%}"
then:
  - service: notify.mobile_app_ss_s24u
    metadata: {}
    data:
      message: "{{ sn }} {{ verb }} the {{ door }}"
      title: "{{ door }}"
      data:
        tag: "{{ door }}"

Mind you, this is untested and me just putting it together some.

I’m getting this error in the HA log when the door is unlocked, or locked

2024-05-10 18:08:36.603 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=lock.front_door, old_state=<state lock.front_door=locked; friendly_name=Front Door, supported_features=0 @ 2024-05-10T16:32:24.272610-05:00>, new_state=<state lock.front_door=unlocked; friendly_name=Front Door, supported_features=0 @ 2024-05-10T18:08:36.603585-05:00>>
2024-05-10 18:08:36.605 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=lock.boltchecked_front_door, old_state=<state lock.boltchecked_front_door=locked; friendly_name=boltchecked_front_door, supported_features=0 @ 2024-05-10T16:32:37.976691-05:00>, new_state=<state lock.boltchecked_front_door=unlocked; friendly_name=boltchecked_front_door, supported_features=0 @ 2024-05-10T18:08:36.605428-05:00>>
2024-05-10 18:08:36.611 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=binary_sensor.front_door_current_status_of_the_door, old_last_reported=2024-05-10T16:32:24.185986-05:00, new_state=<state binary_sensor.front_door_current_status_of_the_door=on; device_class=door, friendly_name=Front Door Current status of the door @ 2024-05-10T16:32:24.185986-05:00>>
**2024-05-10 18:08:36.619 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved**
**Traceback (most recent call last):**
**  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run**
**    result = self.fn(*self.args, **self.kwargs)**
**             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^**
**TypeError: handle_state_change() missing 2 required positional arguments: 'old_state' and 'new_state'**
**2024-05-10 18:08:36.622 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]:** entity_id=sensor.z_wave_controller_zooz_800_series_successful_messages_tx, old_last_reported=2024-05-10T18:08:17.071222-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_successful_messages_tx=3425; state_class=total, friendly_name=Z-Wave Controller Zooz 800 Series Successful messages (TX) @ 2024-05-10T18:08:17.071222-05:00>>
2024-05-10 18:08:36.622 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.z_wave_controller_zooz_800_series_successful_messages_rx, old_state=<state sensor.z_wave_controller_zooz_800_series_successful_messages_rx=3756; state_class=total, friendly_name=Z-Wave Controller Zooz 800 Series Successful messages (RX) @ 2024-05-10T18:08:16.820464-05:00>, new_state=<state sensor.z_wave_controller_zooz_800_series_successful_messages_rx=3757; state_class=total, friendly_name=Z-Wave Controller Zooz 800 Series Successful messages (RX) @ 2024-05-10T18:08:36.622307-05:00>>
2024-05-10 18:08:36.623 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_messages_dropped_tx, old_last_reported=2024-05-10T18:08:17.073062-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_messages_dropped_tx=0; state_class=total, friendly_name=Z-Wave Controller Zooz 800 Series Messages dropped (TX) @ 2024-05-10T16:32:21.758662-05:00>>
2024-05-10 18:08:36.623 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_messages_dropped_rx, old_last_reported=2024-05-10T18:08:17.073594-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_messages_dropped_rx=0; state_class=total, friendly_name=Z-Wave Controller Zooz 800 Series Messages dropped (RX) @ 2024-05-10T16:32:21.759911-05:00>>
2024-05-10 18:08:36.623 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_messages_not_accepted, old_last_reported=2024-05-10T18:08:17.074110-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_messages_not_accepted=0; state_class=total, friendly_name=Z-Wave Controller Zooz 800 Series Messages not accepted @ 2024-05-10T16:32:21.761683-05:00>>
2024-05-10 18:08:36.624 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_collisions, old_last_reported=2024-05-10T18:08:17.074699-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_collisions=4; state_class=total, friendly_name=Z-Wave Controller Zooz 800 Series Collisions @ 2024-05-10T16:32:21.763206-05:00>>
2024-05-10 18:08:36.624 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_missing_acks, old_last_reported=2024-05-10T18:08:17.075222-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_missing_acks=1; state_class=total, friendly_name=Z-Wave Controller Zooz 800 Series Missing ACKs @ 2024-05-10T16:32:21.764307-05:00>>
2024-05-10 18:08:36.624 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_timed_out_responses, old_last_reported=2024-05-10T18:08:17.075730-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_timed_out_responses=0; state_class=total, friendly_name=Z-Wave Controller Zooz 800 Series Timed out responses @ 2024-05-10T16:32:21.765337-05:00>>
2024-05-10 18:08:36.625 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_timed_out_callbacks, old_last_reported=2024-05-10T18:08:17.076235-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_timed_out_callbacks=0; state_class=total, friendly_name=Z-Wave Controller Zooz 800 Series Timed out callbacks @ 2024-05-10T16:32:21.766343-05:00>>
2024-05-10 18:08:36.626 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_average_background_rssi_channel_0, old_last_reported=2024-05-10T18:08:17.076763-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_average_background_rssi_channel_0=-108; unit_of_measurement=dBm, device_class=signal_strength, friendly_name=Z-Wave Controller Zooz 800 Series Average background RSSI (channel 0) @ 2024-05-10T16:32:21.767638-05:00>>
2024-05-10 18:08:36.626 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_current_background_rssi_channel_0, old_last_reported=2024-05-10T18:08:17.079394-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_current_background_rssi_channel_0=-110; state_class=measurement, unit_of_measurement=dBm, device_class=signal_strength, friendly_name=Z-Wave Controller Zooz 800 Series Current background RSSI (channel 0) @ 2024-05-10T18:08:17.079394-05:00>>
2024-05-10 18:08:36.626 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_average_background_rssi_channel_1, old_last_reported=2024-05-10T18:08:17.080694-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_average_background_rssi_channel_1=-109; unit_of_measurement=dBm, device_class=signal_strength, friendly_name=Z-Wave Controller Zooz 800 Series Average background RSSI (channel 1) @ 2024-05-10T16:32:21.770216-05:00>>
2024-05-10 18:08:36.627 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_current_background_rssi_channel_1, old_last_reported=2024-05-10T18:08:17.081228-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_current_background_rssi_channel_1=-110; state_class=measurement, unit_of_measurement=dBm, device_class=signal_strength, friendly_name=Z-Wave Controller Zooz 800 Series Current background RSSI (channel 1) @ 2024-05-10T18:08:17.081228-05:00>>
2024-05-10 18:08:36.627 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_average_background_rssi_channel_2, old_last_reported=2024-05-10T18:08:17.081904-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_average_background_rssi_channel_2=-109; unit_of_measurement=dBm, device_class=signal_strength, friendly_name=Z-Wave Controller Zooz 800 Series Average background RSSI (channel 2) @ 2024-05-10T16:32:21.773518-05:00>>
2024-05-10 18:08:36.627 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=sensor.z_wave_controller_zooz_800_series_current_background_rssi_channel_2, old_last_reported=2024-05-10T18:08:17.082252-05:00, new_state=<state sensor.z_wave_controller_zooz_800_series_current_background_rssi_channel_2=-110; stat```

v0.0.91 should solve this error, thanks!

Well, almost, but now I have a new similar error whenever the door is unlocked or locked

Logger: homeassistant
Source: custom_components/keymaster/helpers.py:271
integration: keymaster ([documentation](https://github.com/FutureTense/keymaster), [issues](https://github.com/FutureTense/keymaster/issues))
First occurred: 2:01:07 PM (2 occurrences)
Last logged: 2:01:15 PM

Error doing job: Future exception was never retrieved

Traceback (most recent call last): File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/keymaster/helpers.py", line 271, in handle_state_change new_state = event.data["new_state"] ^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'data'

Are you still having this problem? I found a way to automate fixing it. It was tested twice and works fine for me.

alias: Reset_Code_(Code_number, I did one for each of the codes for guests)
description: Reset code XX if stuck at adding
trigger:
  - platform: state
    entity_id:
      - sensor.connected_(yourdoor_name_code_number)
    from: null
    to: Adding
    for:
      hours: 0
      minutes: 0
      seconds: 25
condition: []
action:
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.enabled_(yourdoor_name_code_number)
    data: {}
  - service: notify.mobile_app(your_notification, if you want)
    data:
      message: Code XX stuck at adding
  - service: zwave_js.clear_lock_usercode
    data:
      code_slot: "XX"
    target:
      device_id: (yourlock_device_ID)
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.enabled_(yourdoor_name_code_number)
    data: {}
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: notify.mobile_(yourdoor_name_code_number)
    metadata: {}
    data:
      message: Code XX Reset Completed
mode: single

Fix in the pipeline, tested it properly on my dev instance of HA and confirmed it’s working as it should be now.

Keep an eye out for an update here in a few minutes.

After 0.92 … another similar error

Logger: homeassistant.helpers.event
Source: helpers/event.py:327
First occurred: 10:13:02 AM (3 occurrences)
Last logged: 10:14:33 AM

Error while dispatching event for lock.front_door to <Job track state_changed event ['lock.front_door'] HassJobType.Callback functools.partial(<function handle_state_change at 0x7f61b53d80>, <HomeAssistant RUNNING>, <ConfigEntry entry_id=a618f0c9e468d26bcdd866a095bfc6b0 version=2 domain=keymaster title=Front Door state=ConfigEntryState.LOADED unique_id=front_door>)>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 327, in _async_dispatch_entity_id_event
    hass.async_run_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 947, in async_run_hass_job
    hassjob.target(*args)
  File "/config/custom_components/keymaster/helpers.py", line 272, in handle_state_change
    new_state = event.data["new_state"]
                ^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'data'

So this has been asked before, but not really clear if there is a way to do this without changing the lock name itself as it’s imported, or changing the lock name after import and then updating everything. I’m wanting to have a “friendly name” for my locks that are used for the notifications, I’d rather not use the literal lock name since I have a standard I like to keep to keep my devices easy to locate and searchable. So is there a way to say this lock name = use this friendly name in notifications? Thanks!