Last active
July 8, 2023 14:50
-
-
Save DRuggeri/1cde1525529358f40c6f139606e2329b to your computer and use it in GitHub Desktop.
This file contains 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: Motion Activated Anything | |
description: Execute on/off actions based on motion and timeout | |
domain: automation | |
source_url: https://gist.github.com/DRuggeri/1cde1525529358f40c6f139606e2329b | |
input: | |
motion_entity: | |
name: Motion Sensor | |
selector: | |
entity: | |
domain: binary_sensor | |
device_class: | |
- motion | |
- occupancy | |
on_action: | |
name: Motion Detected Action | |
default: [] | |
selector: | |
action: | |
off_action: | |
name: Motion Undetected Action | |
default: [] | |
selector: | |
action: | |
no_motion_wait: | |
name: Wait time | |
description: Time to wait with no motion before triggering the off action | |
default: 300 | |
selector: | |
number: | |
min: 0 | |
max: 3600 | |
unit_of_measurement: seconds | |
# If motion is detected within the delay, | |
# we restart the script. | |
mode: restart | |
max_exceeded: silent | |
trigger: | |
platform: state | |
entity_id: !input motion_entity | |
from: "off" | |
to: "on" | |
action: | |
- choose: | |
- conditions: "{{ true }}" | |
sequence: !input on_action | |
- alias: "Wait until there is no motion from device" | |
wait_for_trigger: | |
platform: state | |
entity_id: !input motion_entity | |
from: "on" | |
to: "off" | |
- alias: "Wait the number of seconds that has been set" | |
delay: !input no_motion_wait | |
- choose: | |
- conditions: "{{ true }}" | |
sequence: !input off_action |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment