Skip to content

Instantly share code, notes, and snippets.

@jeffmccune
Last active August 16, 2021 22:02
Show Gist options
  • Save jeffmccune/89897df9fcf59b2251921903ca0f9b17 to your computer and use it in GitHub Desktop.
Save jeffmccune/89897df9fcf59b2251921903ca0f9b17 to your computer and use it in GitHub Desktop.
Lock Automation
blueprint:
name: Lock Automation
description: Create automations to react to lock actions
domain: automation
input:
device:
name: Lock Device
description: Lock Device
selector:
device:
integration: zwave_js
manufacturer: Allegion
unlock_by_keycode:
name: Unlock by Keycode
description: Actions to run when unlocked by keycoad.
default: []
selector:
action:
mode: single
max_exceeded: silent
trigger:
platform: event
event_type: zwave_js_value_notification
event_data:
device_id: !input device
type: 6
event: 6
condition: []
action:
- service: logbook.log
data:
name: User Code
message: "{{ trigger.event.data.parameters.userId }}"
- service: rest_command.lock_log
data:
time_fired: "{{ trigger.event.time_fired }}"
user_code: "{{ trigger.event.data.parameters.userId }}"
action: "{{ trigger.event.data.event_label }}"
# {
# "event_type": "zwave_js_notification",
# "data": {
# "domain": "zwave_js",
# "node_id": 36,
# "home_id": 3793585327,
# "device_id": "9416e30b0a8d25302807def36144a0ff",
# "command_class": 113,
# "command_class_name": "Notification",
# "label": "Access Control",
# "type": 6,
# "event": 6,
# "event_label": "Keypad unlock operation",
# "parameters": {
# "userId": 1
# }
# },
# "origin": "LOCAL",
# "time_fired": "2021-08-16T21:06:24.786775+00:00",
# "context": {
# "id": "a39bc9f7f00f99153d3f8fc262b77965",
# "parent_id": null,
# "user_id": null
# }
# }
# {
# "event_type": "zwave_js_notification",
# "data": {
# "domain": "zwave_js",
# "node_id": 36,
# "home_id": 3793585327,
# "device_id": "9416e30b0a8d25302807def36144a0ff",
# "command_class": 113,
# "command_class_name": "Notification",
# "label": "Access Control",
# "type": 6,
# "event": 1,
# "event_label": "Manual lock operation",
# "parameters": {}
# },
# "origin": "LOCAL",
# "time_fired": "2021-08-16T21:06:29.384394+00:00",
# "context": {
# "id": "2f912e86ff8a1d940f98934ecf230589",
# "parent_id": null,
# "user_id": null
# }
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment