motion_light rewritten (no permanence between two motion sensor)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
blueprint:
|
||||
name: Dual Sensor Motion-activated Light Customised temporary no sun condition
|
||||
name: Dual Sensor Motion-activated Light Customised with selectable condition after sunset and before sunrise
|
||||
description: Turn on a light when motion is detected.
|
||||
domain: automation
|
||||
# source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
|
||||
@@ -22,7 +22,7 @@ blueprint:
|
||||
device_class: motion
|
||||
domain: binary_sensor
|
||||
light_target:
|
||||
name: Light`
|
||||
name: Light
|
||||
selector:
|
||||
target:
|
||||
entity:
|
||||
@@ -46,43 +46,39 @@ blueprint:
|
||||
trigger_variables:
|
||||
use_sun: !input sun_condition
|
||||
|
||||
# If motion is detected within the delay,
|
||||
# we restart the script.
|
||||
mode: restart
|
||||
max_exceeded: silent
|
||||
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity_down
|
||||
from: "off"
|
||||
entity_id:
|
||||
- !input motion_entity_up
|
||||
- !input motion_entity_down
|
||||
to: "on"
|
||||
id: motion-detected
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity_up
|
||||
from: "off"
|
||||
to: "on"
|
||||
entity_id:
|
||||
- !input motion_entity_up
|
||||
- !input motion_entity_down
|
||||
to: "off"
|
||||
for:
|
||||
hours: 0
|
||||
minutes: 0
|
||||
seconds: !input no_motion_wait
|
||||
|
||||
# Temporary no condition for scala taverna
|
||||
conditions: []
|
||||
# Unable to set different condition based on sun condition flag
|
||||
|
||||
actions:
|
||||
- alias: "Turn on the light"
|
||||
action: light.turn_on
|
||||
target: !input light_target
|
||||
- alias: "Wait until there is no motion from up device"
|
||||
wait_for_trigger:
|
||||
trigger: state
|
||||
entity_id: !input motion_entity_up
|
||||
# from: "on"
|
||||
to: "off"
|
||||
- alias: "Wait until there is no motion from down device"
|
||||
wait_for_trigger:
|
||||
trigger: state
|
||||
entity_id: !input motion_entity_down
|
||||
# from: "on"
|
||||
to: "off"
|
||||
- alias: "Wait the number of seconds that has been set"
|
||||
delay: !input no_motion_wait
|
||||
- alias: "Turn off the light"
|
||||
action: light.turn_off
|
||||
target: !input light_target
|
||||
- if:
|
||||
- condition: trigger
|
||||
id:
|
||||
- motion-detected
|
||||
then:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data: {}
|
||||
else:
|
||||
- action: light.turn_off
|
||||
metadata: {}
|
||||
data:
|
||||
transition: 10
|
||||
target: !input light_target
|
||||
|
||||
mode: single
|
||||
|
||||
Reference in New Issue
Block a user