Last active
April 2, 2024 04:37
-
-
Save ahutchings/9ec7db38323c2b02db075bd12bf4dcad to your computer and use it in GitHub Desktop.
Home Assistant Blueprint: Auto-Lock Door
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Auto-Lock Door | |
description: "Auto-lock a door when it is closed and unlocked." | |
domain: automation | |
source_url: https://gist.github.com/ahutchings/9ec7db38323c2b02db075bd12bf4dcad | |
input: | |
door_lock: | |
name: Door Lock | |
selector: | |
entity: | |
domain: lock | |
door_sensor: | |
name: Door Sensor | |
selector: | |
entity: | |
domain: binary_sensor | |
device_class: door | |
delay: | |
name: Delay | |
description: Delay before locking the door. | |
default: 30 | |
selector: | |
number: | |
min: 0 | |
max: 180 | |
unit_of_measurement: seconds | |
alias: Auto-Lock Door | |
description: "Auto-lock a door when it is closed and unlocked." | |
trigger: | |
- platform: state | |
entity_id: !input door_sensor | |
to: "off" | |
for: | |
seconds: !input delay | |
- platform: state | |
entity_id: !input door_lock | |
to: unlocked | |
for: | |
seconds: !input delay | |
condition: | |
- condition: state | |
entity_id: !input door_lock | |
state: unlocked | |
- condition: state | |
entity_id: !input door_sensor | |
state: "off" | |
action: | |
- service: lock.lock | |
target: | |
entity_id: !input door_lock | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment