Keymaster notifications are delayed by 1 step

I’ve just set up a Schlage Connect Z-Wave deadbolt (BE469ZP) through a Zooz Z-wave 800 stick. I already have it working in Home Assistant for lock/unlock, as well as user codes via Keymaster. I’m using Home Assistant on a docker container, with zwave-js-ui on a separate container.

However when I tried to set up notifications, I got this weird issue where the notifications sent to my phone are always one step behind what actually happened. I.e. the notification I get is always for the previous event.

For example, if I unlock the door via a code, the notification I’ll get is whatever the previous event was (likely either a manual lock or an RF lock). Then let’s say I lock the door again manually, that’s when I’ll receive the notification that it was unlocked via code. Then whatever action I do on the lock next, that’s when the notification will trigger for the manual lock. It’s weird.

Any idea on what might be going on here?

How. - Exactly - did you do this including any custom automation or yaml

Hi,

I added this to scripts.yaml:

keymaster_frontdoor_manual_notify:
  alias: keymaster_frontdoor_manual_notify
  sequence:
  - service: notify.mobile_app_galaxy_s23
    data:
      title: '{{ title }}'
      message: '{{ message }}'
      data:
        channel: Front Door Lock
  mode: parallel
  icon: mdi:lock-smart

then enabled notifications for my individual user codes in Keymaster:

Are you seeing any delay on notification for anything besides keymaster?

Not really. Just the usual few seconds of delay when not using a persistent connection. Even the notifications from Keymaster arrive within seconds – it’s just that it sends the notification for the previous event instead of the current one.

It’s as if there’s a queue/cache holding the previous event, then the next event will push it out into a notification and takes its place in the queue.

1 Like

Not sure if it will help if finding the issue, but I noticed another strange thing with the notifications. Sometimes when I unlock the deadbolt via the keypad, it would actually send the correct notification:

Keypad unlock operation (User1)

However when I perform the next action on the deadbolt, it would send a duplicate, but slightly differently-worded version of the previous notification:

Keypad Unlock (User1)

Notice that the second one does not have “operation” in it. After this, any subsequent actions create notifications that are delayed by 1 step as usual. Not sure if that has any significance, but hopefully it would provide some sort of clue as to what’s happening.

What I ended up doing was to disable Keymaster notifications altogether, and build my own via automations.

Most of the notifications I build were based on zwave_js_notification events, such as the example here:

alias: Front Door Unlocked Via Keypad (Code 1)
description: ""
trigger:
  - platform: event
    event_type: zwave_js_notification
    event_data:
      node_id: 2
      command_class: 113
      type: 6
      event: 6
      parameters:
        userId: 1
condition: []
action:
  - service: notify.all_devices
    data:
      title: Front Door
      message: >-
        Front Door Unlocked via Keypad ({{ states('input_text.frontdoor_name_1')
        }})
      data:
        channel: Front Door Lock
mode: single

The states template gets the name associated with code slot 1 in keymaster. I made similar automations for the other slots (userId corresponds to the slot number), as well as manual locks/unlock events. Note that the event data values will be different depending on your setup, and it’s best to use the Listen to Events feature in Developer tools to get the correct values.

The RF lock/unlock actions do not seem to generate zwave_js_notification events, so I used the state_changed event for alarmlevel instead. This seems to trigger after alarmtype, so checking it ensures that both alarmtype and alarmlevel have already changed:

alias: Front Door Locked via App
description: ""
trigger:
  - platform: event
    event_type: state_changed
    event_data:
      entity_id: sensor.touchscreen_deadbolt_z_wave_plus_alarmlevel_frontdoor
condition:
  - condition: and
    conditions:
      - condition: state
        entity_id: sensor.touchscreen_deadbolt_z_wave_plus_alarmtype_frontdoor
        attribute: value
        state: 24
      - condition: state
        entity_id: sensor.touchscreen_deadbolt_z_wave_plus_alarmlevel_frontdoor
        attribute: value
        state: 1
action:
  - service: notify.all_devices
    data:
      message: Front Door Locked via App
      title: Front Door
      data:
        channel: Front Door Lock
mode: single

For RF unlock events, I check for alarmtype 25 instead, although again these values may be different depending on your device/setup.

I know this doesn’t really fix the Keymaster issue, but I hope it helps in case anyone else is having the same issue.