Add motion_activated_scene.yaml
This commit is contained in:
119
motion_activated_scene.yaml
Normal file
119
motion_activated_scene.yaml
Normal file
@@ -0,0 +1,119 @@
|
||||
blueprint:
|
||||
name: Motion activated scene
|
||||
description: Activates different scenes for daytime/nighttime on detecting motion and returns to an off-scene after a configurable timeout or exceeded illuminace threshold.
|
||||
domain: automation
|
||||
author: Florian Klemenz
|
||||
input:
|
||||
motion_entity:
|
||||
name: Motion Sensor
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
device_class: motion
|
||||
domain: binary_sensor
|
||||
no_motion_wait:
|
||||
name: Wait time
|
||||
description: Time to leave the scene on after last motion is detected.
|
||||
default: 120
|
||||
selector:
|
||||
number:
|
||||
min: 0
|
||||
max: 300
|
||||
unit_of_measurement: seconds
|
||||
illuminance_sensor:
|
||||
name: Illuminance sensor
|
||||
description: The illuminance sensor to get lux data.
|
||||
selector:
|
||||
entity:
|
||||
domain: sensor
|
||||
device_class: illuminance
|
||||
illuminance_cutoff:
|
||||
name: Illuminance threshold
|
||||
description: Lux above this threshold will activate the "off" scene.
|
||||
default: 10
|
||||
selector:
|
||||
number:
|
||||
min: 0
|
||||
max: 100
|
||||
unit_of_measurement: lx
|
||||
daytime_trigger:
|
||||
name: Daytime
|
||||
description: Binary sensor (TimeOfDay) or schedule to indicate when it is daytime
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
- integration: tod
|
||||
domain: binary_sensor
|
||||
- domain: schedule
|
||||
daytime_scene:
|
||||
name: Daytime scene
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
domain: scene
|
||||
nighttime_scene:
|
||||
name: Nighttime scene
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
domain: scene
|
||||
off_scene:
|
||||
name: Off scene
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
domain: scene
|
||||
|
||||
# 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:
|
||||
# "Activate off-scene if illuminance is above threshold"
|
||||
- conditions:
|
||||
- condition: numeric_state
|
||||
entity_id: !input illuminance_sensor
|
||||
above: !input illuminance_cutoff
|
||||
sequence:
|
||||
- service: scene.turn_on
|
||||
target:
|
||||
entity_id: !input off_scene
|
||||
- conditions: []
|
||||
sequence:
|
||||
# "Activate day-/-night scene depending on time of day"
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: state
|
||||
alias: "Check for daytime"
|
||||
entity_id: !input daytime_trigger
|
||||
state: 'on'
|
||||
sequence:
|
||||
- service: scene.turn_on
|
||||
target:
|
||||
entity_id: !input daytime_scene
|
||||
- conditions: []
|
||||
sequence:
|
||||
- service: scene.turn_on
|
||||
target:
|
||||
entity_id: !input nighttime_scene
|
||||
- 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
|
||||
- alias: "Activate off scene"
|
||||
service: scene.turn_on
|
||||
target:
|
||||
entity_id: !input off_scene
|
||||
|
||||
Reference in New Issue
Block a user