WIP dual motion not working

This commit is contained in:
2024-11-04 21:04:22 +01:00
parent c2f023d80c
commit 437553f5ec
4 changed files with 164 additions and 38 deletions

View File

@@ -0,0 +1,88 @@
blueprint:
name: Dual Sensor Motion-activated Light Customised temporary no sun condition
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
author: Home Assistant Rewised by Tiziano Trabattoni
input:
motion_entity_down:
name: Motion Sensor (Sensore Basso)
description: Sensore parte bassa della scala
selector:
entity:
filter:
device_class: motion
domain: binary_sensor
motion_entity_up:
name: Motion Sensor (Sensore Alto)
description: Sensore parte alta della scala
selector:
entity:
filter:
device_class: motion
domain: binary_sensor
light_target:
name: Light`
selector:
target:
entity:
domain: light
sun_condition:
name: Sun_driven
description: Controlled by sunrise and sunset
default: on
selector:
boolean:
no_motion_wait:
name: Wait time
description: Time to leave the light on after last motion is detected.
default: 30
selector:
number:
min: 10
max: 120
unit_of_measurement: seconds
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"
to: "on"
- trigger: state
entity_id: !input motion_entity_up
from: "off"
to: "on"
# 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