Skip to content

Instantly share code, notes, and snippets.

@JohnONolan
Created November 2, 2021 01:02
Show Gist options
  • Select an option

  • Save JohnONolan/ed97404a68ea62d9020a64081442a579 to your computer and use it in GitHub Desktop.

Select an option

Save JohnONolan/ed97404a68ea62d9020a64081442a579 to your computer and use it in GitHub Desktop.
blueprint:
name: Door Sensor Light
description: Turn a light when a door is opened
domain: automation
input:
doorsensor_entity:
name: Door Sensor
selector:
entity:
domain: binary_sensor
light_target:
name: Light
selector:
target:
entity:
domain: light
door_closed_wait:
name: Wait time
description: Time to leave the light on after door is closed
default: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
mode: restart
trigger:
platform: state
entity_id: !input doorsensor_entity
from: "off"
to: "on"
condition: []
action:
- service: light.turn_on
target: !input light_target
- wait_for_trigger:
platform: state
entity_id: !input doorsensor_entity
from: "on"
to: "off"
for: !input door_closed_wait
- service: light.turn_off
target: !input light_target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment