Skip to content

Instantly share code, notes, and snippets.

@samj
Last active December 2, 2023 21:20
Show Gist options
  • Save samj/5dfa0f62b4bb3c0d5f59e4d58d473229 to your computer and use it in GitHub Desktop.
Save samj/5dfa0f62b4bb3c0d5f59e4d58d473229 to your computer and use it in GitHub Desktop.
blueprint:
name: Set door codes webhook
description: >
Webhook that sets a door code slot on multiple lock entities using set_usercode.
IMPORTANT: When setting up this automation, click the gear icon beside the Webhook ID
to choose whether the webhook is 'Only accessible from the local network'.
domain: automation
input:
secret_token:
name: Secret Token
description: The secret token to authenticate the webhook (e.g., bedeeba70c4ee335bc44964795f35cd0)
selector:
text:
webhook_id:
name: Webhook ID
description: The ID of the webhook to trigger the automation.
selector:
text:
default: 'set_door_codes'
local_only:
name: Local Only
description: Whether the webhook is only accessible from the local network
selector:
boolean:
default: true
trigger:
- platform: webhook
webhook_id: !input 'webhook_id'
local_only: !input 'local_only'
action:
- service: system_log.write
data_template:
message: >-
Received token: {{ trigger.json.token }},
Expected token: {{ states('input_text.secret_token') }}
level: warning
- repeat:
sequence:
- service: zwave_js.set_lock_usercode
data:
entity_id: "{{ entity }}"
code_slot: "{{ trigger.json.code_slot }}"
user_code: "{{ trigger.json.user_code }}"
for_each: "{{ trigger.json.entity_ids }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment