KeyMaster Z-Wave lock manager and scheduler

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!

Ditto. Identical error except occurrences (8) and logged time.

(I see an old version of the code on github, is the newer versions no longer up there? Asking to know where/how you want proper reporting.)

v0.0.93 is out now

Fixed … Thanks :+1:

1 Like

No one has a solution?

Just double check that the name is the same. Sometimes I forget the “_” and use spaces instead. It doesn’t like space.

It has something to do the the fake sensor, but I’ve forgotten how to get rid of it.

Hi Andrew, came across your post here about remote home assistant. I’m trying to pull the keymaster lovelace dashboard view from other instances of home assistant into a single one so i can manage all the locks from one webpage. Is this possible? Or is there another way to do this, having the dashboard view for locks from other instances of home assistant? @tykeal @jwsample

I’ve never tried the Remote Home Assistant integration. I would assume that you need that before anything else would work.

While the idea of linking HA instances together seems great at first to me, I came to realize long before I ever implemented it, that I have a desire for each of my HA instances to be fully independent given that they are used for my home itself and then rental properties. I don’t want the possibility of one of my HA units in a rental property to have access to my home or other HA instances.

Instead what I do is manage them all independently and develop blueprints for common automations where I keep doing the same sort of thing in each system. The code management is primarily done by way of my Rental Control integration that I wrote and maintain for it driving the slots in Keymaster.

1 Like

I use Remote Home Assistant for this exact purpose.

Remote Homes Assistant with KeyMaster is perfect as a Dashboard view. To have a centralized location where you can very everything. For me this works perfectly as I use a separate HA install for testing purpose and as a central control, so it is not necessary to log into to each instance to get something done.

So I have several ‘central’ automations, like those that tell me when a device is offline, which work better than each instance reporting which item is offline because the problem could be widespread. Like, recently one instance when offline, but it didn’t report anything because it was a whole house power failure. But the ‘central’ instance reported the devices offline.

I have remote home assistant installed on each, and connected successfully. I’m not sure how you import the dashboards though? All I see are how to import entities, and so far it’s imported all my automations but yeah, trying to just import the other Keymaster dashboards from the other instances