I am using a script to notify me of people entering the house via one of the doors. The script is a copy of GitHub - desertblade/Keymaster-Basic: Simple Home Assistant Lock Manager
For some reason the notification is always sharing the same timestamp “USER unlocked the door via keypad at 17:29:33” even if the event is triggered at 09:21:14
I’ve included the tracelog and the code as implemented in the automation.
Executed: October 29, 2023 at 09:21:14
Result:params:
domain: input_text
service: set_value
service_data:
value: 1
entity_id:
- input_text.last_lock_unlock_code_slot
target:
entity_id:
- input_text.last_lock_unlock_code_slot
running_script: false
Executed: October 29, 2023 at 09:21:14
Result:choice: 0
Executed: October 29, 2023 at 09:21:14
Result:result: true
conditions/0
Executed: October 29, 2023 at 09:21:14
Result:result: true
entities:
- input_boolean.lock_code_slot_1_notify
- input_text.last_lock_unlock_code_slot
Executed: October 29, 2023 at 09:21:14
Result:params:
domain: notify
service: lock_notify_group
service_data:
message: USER unlocked the door via keypad at 17:29:33
target: {}
running_script: false
alias: Lock Notifications
description: notify when certain codes are used to unlock the doors, if notify is enabled
trigger:
- platform: event
event_type: zwave_js_notification
event_data:
command_class: 113
command_class_name: Notification
label: Access Control
type: 6
event: 6
event_label: Keypad unlock operation
condition: []
action:
- service: input_text.set_value
data:
value: '{{trigger.event | replace(''>'','''') | last}}'
target:
entity_id: input_text.last_lock_unlock_code_slot
- choose:
- conditions:
- condition: template
value_template: |2
{% set mysensor = "input_boolean.lock_code_slot_" ~ states('input_text.last_lock_unlock_code_slot') ~ "_notify" %}
{{is_state(mysensor, 'on') }}
sequence:
- service: notify.lock_notify_group
data:
message: >-
{% set namesensor = "input_text.lock_code_slot_" ~
states('input_text.last_lock_unlock_code_slot') ~ "_name" %} {{
states(namesensor)}} unlocked the door via keypad at
{{as_timestamp(states.input_text.last_lock_unlock_code_slot.last_changed)
| timestamp_custom("%H:%M:%S",local=True)}}
mode: single