core/homeassistant/components/automation/blueprints/motion_light.yaml

41 lines
944 B
YAML
Raw Normal View History

blueprint:
name: Motion-activated Light
domain: automation
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
2020-11-28 22:33:32 +00:00
light_target:
name: Light
selector:
2020-11-28 22:33:32 +00:00
target:
entity:
domain: light
# If motion is detected within the 120s delay,
# we restart the script.
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !placeholder motion_entity
from: "off"
to: "on"
action:
- service: homeassistant.turn_on
2020-11-28 22:33:32 +00:00
target: !placeholder light_target
- wait_for_trigger:
platform: state
entity_id: !placeholder motion_entity
from: "on"
to: "off"
- delay: 120
- service: homeassistant.turn_off
2020-11-28 22:33:32 +00:00
target: !placeholder light_target