Z-Wave JS Locks in Home Assistant – Now See Who Opened The Door

As mentioned in the video I have included the automations here for the three examples I showed in the video.

Of course make sure that your entity IDs match up with your system.

Display Lock Status

alias: Front Lock - Lock Status
description: ''
trigger:
  - platform: event
    event_type: zwave_js_notification
condition:
  - condition: template
    value_template: '{{ trigger.event.data.device_id == ''[[Lock Device ID]]'' }}'
action:
  - service: input_text.set_value
    target:
      entity_id: input_text.front_lock_status
    data:
      value: '{{trigger.event.data.event_label}}'
mode: single

This code will take the event label and push it to our helper to be able to be displayed in Home Assistant.

Display Lock User Code

alias: Front Lock - Lock Code
description: ''
trigger:
  - platform: event
    event_type: zwave_js_notification
condition:
  - condition: template
    value_template: '{{ trigger.event.data.device_id == ''[[Lock Device ID]]'' }}'
  - condition: template
    value_template: '{{ trigger.event.data.event == 6 }}'
action:
  - service: input_number.set_value
    data_template:
      entity_id: input_number.last_front_door_code
      value: '{{trigger.event.data.parameters.userId | int}}'
mode: single

This automation will do the same as above, except display the user code that was entered on the door.

Display Lock User Name

alias: Front Lock - Lock Code
description: ''
trigger:
  - platform: event
    event_type: zwave_js_notification
condition:
  - condition: template
    value_template: '{{ trigger.event.data.device_id == ''445eaa0e224212106f75062e28800af3'' }}'
  - condition: template
    value_template: '{{ trigger.event.data.event == 6 }}'
action:
  - service: input_number.set_value
    data_template:
      entity_id: input_number.last_front_door_code
      value: '{{trigger.event.data.parameters.userId | int}}'
  - service: input_text.set_value
    data_template:
      entity_id: input_text.front_lock_user
      value: >
'{% if states('input_number.last_front_door_code') | int == 1 %}
  Code1
{% elif states('input_number.last_front_door_code') | int == 2 %}
  Code2
{% elif states('input_number.last_front_door_code') | int == 3 %}
  Code3
{% elif states('input_number.last_front_door_code') | int == 4 %}
  Code4
{% elif states('input_number.last_front_door_code') | int == 5 %}
  Code5
{% elif states('input_number.last_front_door_code') | int == 6 %}
  Code6
{% elif states('input_number.last_front_door_code') | int == 7 %}
  Code7
{% elif states('input_number.last_front_door_code') | int == 8 %}
  Code8
{% elif states('input_number.last_front_door_code') | int == 9 %}
  Code9
{% else %}
  Error
{% endif %}'
mode: single

This automation is exactly the same as the User Code one above, except it allows you to match the user code with an actual name.

Disarm Smart Alarm with Door Code

alias: Front Lock - Disarm Alarm
description: ''
trigger:
  - platform: event
    event_type: zwave_js_notification
condition:
  - condition: template
    value_template: '{{ trigger.event.data.device_id == ''[[Lock Device ID]]'' }}'
  - condition: template
    value_template: '{{ trigger.event.data.event == 6 }}'
  - condition: not
    conditions:
      - condition: state
        entity_id: alarm_control_panel.shm
        state: Disarmed
action:
  - service: alarm_control_panel.alarm_disarm
    target:
      entity_id: alarm_control_panel.shm
    data:
      code: '1111'
  - service: notify.telegram
    data:
      title: HA Alarm Status
      message: >-
        The alarm has been disarmed by user code
        {{trigger.event.data.parameters.userId}}
mode: single

Update: I forgot to add a condition to check to see if the house is armed before running this automation. That has been added now.

2 comments

  1. Great write up! There seems to be a typo somewhere in your Display Lock User Name YAML. When I try to paste it in, it converts the value: > into value: | and the automation wont work. Do you happen to know what needs to be fixed?

Comments are closed.