motion light Dual and Trix OK - cleanuo of blueprint directory
This commit is contained in:
@@ -1,115 +0,0 @@
|
||||
blueprint:
|
||||
name: Motion-activated Light NEW
|
||||
description: Turn on a light when motion is detected NEW.
|
||||
domain: automation
|
||||
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
|
||||
author: Tiziano Trabattoni
|
||||
input:
|
||||
motion_entity1:
|
||||
name: Motion-sensor1
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
device_class: motion
|
||||
domain: binary_sensor
|
||||
motion_entity2:
|
||||
name: Motion-sensor2
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
device_class: motion
|
||||
domain: binary_sensor
|
||||
light_target:
|
||||
name: Light
|
||||
selector:
|
||||
target:
|
||||
entity:
|
||||
domain: light
|
||||
no_motion_wait:
|
||||
name: Wait time
|
||||
description: Time to leave the light on after last motion is detected.
|
||||
default: 20
|
||||
selector:
|
||||
number:
|
||||
min: 0
|
||||
max: 300
|
||||
unit_of_measurement: seconds
|
||||
|
||||
# If motion is detected within the delay,
|
||||
# we restart the script.
|
||||
mode: restart
|
||||
max_exceeded: silent
|
||||
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity1
|
||||
from: "off"
|
||||
to: "on"
|
||||
id: motion_entity1_on
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity2
|
||||
from: "off"
|
||||
to: "on"
|
||||
id: motion_entity2_on
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity1
|
||||
from: "on"
|
||||
to: "off"
|
||||
id: motion_entity1_off
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity2
|
||||
from: "on"
|
||||
to: "off"
|
||||
id: motion_entity2_off
|
||||
|
||||
variables:
|
||||
light_target_var: !input light_target
|
||||
motion_entity1_var: !input motion_entity1
|
||||
motion_entity2_var: !input motion_entity2
|
||||
|
||||
actions:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id:
|
||||
- motion_entity1_on
|
||||
- motion_entity2_on
|
||||
sequence:
|
||||
# POSSIBILE baco, dovrebbe essere come di seguito ma la condizione dell'IF non funziona con le variabili qui ma e' ok nella validazione del templating
|
||||
# - if:
|
||||
# - condition: template
|
||||
# value_template: "{{ states( light_target_var) == 'off' }}"
|
||||
# then:
|
||||
# - alias: "Turn on the light"
|
||||
# action: light.turn_on
|
||||
# target: !input light_target
|
||||
|
||||
- alias: "Turn on the light"
|
||||
action: light.turn_on
|
||||
target: !input light_target
|
||||
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id:
|
||||
- motion_entity1_off
|
||||
- motion_entity2_off
|
||||
sequence:
|
||||
- if:
|
||||
- alias: "None of motion sensor are detected"
|
||||
condition: not
|
||||
conditions:
|
||||
# - condition: template
|
||||
# value_template: "{{ is_state('binary_sensor.presenza_alta_scala_mansarda_occupancy', 'on') }}"
|
||||
# - condition: template
|
||||
# value_template: "{{ is_state('binary_sensor.presenza_bassa_scala_mansarda_occupancy', 'on') }}"
|
||||
- condition: template
|
||||
value_template: "{{ is_state(motion_entity1_var, 'on') }}"
|
||||
- condition: template
|
||||
value_template: "{{ is_state(motion_entity2_var, 'on') }}"
|
||||
|
||||
then:
|
||||
- alias: "Wait for delay set before turn off"
|
||||
delay: !input no_motion_wait
|
||||
- alias: "Turn off the light"
|
||||
action: light.turn_off
|
||||
target: !input light_target
|
||||
@@ -1,148 +0,0 @@
|
||||
blueprint:
|
||||
name: Dual Sensor Sunset and Luminescence Motion-activated Light
|
||||
description: Turn on a light when motion is detected (with Sunrise / Sunset / Luminance).
|
||||
domain: automation
|
||||
# source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
|
||||
author: 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:
|
||||
dont_disturb_condition:
|
||||
name: dont_disturb_light_control
|
||||
description: Controls if lamp brightness has to be reduced to not disturb
|
||||
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
|
||||
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id:
|
||||
- !input motion_entity_up
|
||||
- !input motion_entity_down
|
||||
to: "on"
|
||||
id: motion-detected
|
||||
- trigger: state
|
||||
entity_id:
|
||||
- !input motion_entity_up
|
||||
- !input motion_entity_down
|
||||
to: "off"
|
||||
for:
|
||||
hours: 0
|
||||
minutes: 0
|
||||
seconds: !input no_motion_wait
|
||||
|
||||
conditions: []
|
||||
|
||||
actions:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ use_sun }}"
|
||||
sequence:
|
||||
# we need to use either external luminescence or sunrise and sunset conditions
|
||||
- if:
|
||||
- or:
|
||||
# external light is LOW (below Helper daylight_luminescence set value)
|
||||
- condition: template
|
||||
value_template: "{{ ( states('sensor.esterno_luminosita_illuminance_lux') | int ) < ( states('input_number.daylight_luminescence') | int ) }}"
|
||||
# after sunrise and before sunset
|
||||
- condition: sun
|
||||
after: sunset
|
||||
after_offset: "-01:00:00"
|
||||
before: sunrise
|
||||
before_offset: "+01:00:00"
|
||||
then:
|
||||
- if:
|
||||
- condition: trigger
|
||||
id:
|
||||
- motion-detected
|
||||
then:
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ dont_disturb_condition }}"
|
||||
then:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: states('input_number.dont_disturb_light_brightness')
|
||||
color_temp_kelvin: 2500
|
||||
else:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: 100
|
||||
color_temp_kelvin: 2500
|
||||
else:
|
||||
- action: light.turn_off
|
||||
metadata: {}
|
||||
data:
|
||||
transition: 10
|
||||
target: !input light_target
|
||||
default:
|
||||
# the motion light is always active
|
||||
- if:
|
||||
- condition: trigger
|
||||
id:
|
||||
- motion-detected
|
||||
then:
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ dont_disturb_condition }}"
|
||||
then:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: states('input_number.dont_disturb_light_brightness')
|
||||
color_temp_kelvin: 2500
|
||||
else:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: 100
|
||||
color_temp_kelvin: 2500
|
||||
else:
|
||||
- action: light.turn_off
|
||||
metadata: {}
|
||||
data:
|
||||
transition: 10
|
||||
target: !input light_target
|
||||
|
||||
mode: single
|
||||
164
blueprints/automation/homeassistant/motion_light_dual_ng.yaml
Normal file
164
blueprints/automation/homeassistant/motion_light_dual_ng.yaml
Normal file
@@ -0,0 +1,164 @@
|
||||
blueprint:
|
||||
name: Motion-activated-Light NG (dual motion sensors)
|
||||
description: Turn on a light when motion is detected NG (dual motion sensor)
|
||||
domain: automation
|
||||
author: Tiziano Trabattoni
|
||||
input:
|
||||
motion_entity1:
|
||||
name: Motion-sensor1
|
||||
description: First Sensor motion entity
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
device_class: motion
|
||||
domain: binary_sensor
|
||||
motion_entity2:
|
||||
name: Motion-sensor2
|
||||
description: Second Sensor motion entity
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
device_class: motion
|
||||
domain: binary_sensor
|
||||
light_target:
|
||||
name: Light
|
||||
description: Entity of the Lamp to be controlled
|
||||
selector:
|
||||
target:
|
||||
entity:
|
||||
domain: light
|
||||
use_sun:
|
||||
name: Sun_driven
|
||||
description: Controlled by sunrise and sunset flag
|
||||
default: on
|
||||
selector:
|
||||
boolean:
|
||||
dont_disturb:
|
||||
name: dont_disturb_light_control
|
||||
description: Controls if lamp brightness has to be reduced to not disturb
|
||||
default: on
|
||||
selector:
|
||||
boolean:
|
||||
no_motion_wait:
|
||||
name: Wait time
|
||||
description: Time to leave the light on after last motion is detected.
|
||||
default: 20
|
||||
selector:
|
||||
number:
|
||||
min: 0
|
||||
max: 300
|
||||
unit_of_measurement: seconds
|
||||
|
||||
# Every motion state change is captured and managed by the script therefore we need to restart by queueing triggers
|
||||
# in this automation the poweroff of light is started only if all managed motion sensor are in clear state (= "off")
|
||||
mode: queued
|
||||
max_exceeded: silent
|
||||
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity1
|
||||
from: "off"
|
||||
to: "on"
|
||||
id: motion_entity1_on
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity2
|
||||
from: "off"
|
||||
to: "on"
|
||||
id: motion_entity2_on
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity1
|
||||
from: "on"
|
||||
to: "off"
|
||||
id: motion_entity1_off
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity2
|
||||
from: "on"
|
||||
to: "off"
|
||||
id: motion_entity2_off
|
||||
|
||||
variables:
|
||||
use_sun_flag: !input use_sun
|
||||
dont_disturb_flag: !input dont_disturb
|
||||
light_target_var: !input light_target
|
||||
motion_entity1_var: !input motion_entity1
|
||||
motion_entity2_var: !input motion_entity2
|
||||
|
||||
actions:
|
||||
- choose:
|
||||
# Conditions for triggering on light
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id:
|
||||
- motion_entity1_on
|
||||
- motion_entity2_on
|
||||
sequence:
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ use_sun_flag }}"
|
||||
then: # Sun and luminescence controlled
|
||||
- if:
|
||||
- or:
|
||||
# external light is LOW (below Helper daylight_luminescence set value)
|
||||
- condition: template
|
||||
value_template: "{{ ( states('sensor.esterno_luminosita_illuminance_lux') | int ) < ( states('input_number.daylight_luminescence') | int ) }}"
|
||||
# after sunrise and before sunset
|
||||
- condition: sun
|
||||
after: sunset
|
||||
after_offset: "-01:00:00"
|
||||
before: sunrise
|
||||
before_offset: "+01:00:00"
|
||||
then:
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ dont_disturb_flag }}"
|
||||
then:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: "{{ states('input_number.dont_disturb_light_brightness') | float }}"
|
||||
color_temp_kelvin: 2500
|
||||
else:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: 100
|
||||
color_temp_kelvin: 2500
|
||||
else: # Always active
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ dont_disturb_flag }}"
|
||||
then:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: "{{ states('input_number.dont_disturb_light_brightness') | float }}"
|
||||
color_temp_kelvin: 2500
|
||||
else:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: 100
|
||||
color_temp_kelvin: 2500
|
||||
|
||||
# conditions for triggering off lights
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id:
|
||||
- motion_entity1_off
|
||||
- motion_entity2_off
|
||||
sequence:
|
||||
- if:
|
||||
- alias: "None of motion sensor are detected"
|
||||
condition: not
|
||||
conditions:
|
||||
- condition: template
|
||||
value_template: "{{ is_state(motion_entity1_var, 'on') }}"
|
||||
- condition: template
|
||||
value_template: "{{ is_state(motion_entity2_var, 'on') }}"
|
||||
|
||||
then:
|
||||
- alias: "Wait for delay set before turn off"
|
||||
delay: !input no_motion_wait
|
||||
- alias: "Turn off the light"
|
||||
action: light.turn_off
|
||||
target: !input light_target
|
||||
@@ -1,164 +0,0 @@
|
||||
blueprint:
|
||||
name: Tris Sensor Sunset and Luminescence Motion-activated Light
|
||||
description: Turn on a light when motion is detected (with Sunrise / Sunset / Luminance).
|
||||
domain: automation
|
||||
# source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
|
||||
author: Tiziano Trabattoni
|
||||
input:
|
||||
motion_entity_uno:
|
||||
name: Motion Sensor (Sensore Uno)
|
||||
description: Sensore Uno
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
device_class: motion
|
||||
domain: binary_sensor
|
||||
motion_entity_due:
|
||||
name: Motion Sensor (Sensore Due)
|
||||
description: Sensore Due
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
device_class: motion
|
||||
domain: binary_sensor
|
||||
motion_entity_tre:
|
||||
name: Motion Sensor (Sensore Tre)
|
||||
description: Sensore tre
|
||||
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:
|
||||
|
||||
dont_disturb_condition:
|
||||
name: dont_disturb_light_control
|
||||
description: Controls if lamp brightness has to be reduced to not disturb
|
||||
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
|
||||
# use_dont_disturb: !input dont_disturb_nighttime
|
||||
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id:
|
||||
- !input motion_entity_uno
|
||||
- !input motion_entity_due
|
||||
- !input motion_entity_tre
|
||||
to: "on"
|
||||
id: motion-detected
|
||||
- trigger: state
|
||||
entity_id:
|
||||
- !input motion_entity_uno
|
||||
- !input motion_entity_due
|
||||
- !input motion_entity_tre
|
||||
to: "off"
|
||||
for:
|
||||
hours: 0
|
||||
minutes: 0
|
||||
seconds: !input no_motion_wait
|
||||
id: motion-cleared
|
||||
|
||||
conditions: []
|
||||
|
||||
actions:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ use_sun }}"
|
||||
sequence:
|
||||
# we need to use either external luminescence or sunrise and sunset conditions
|
||||
- if:
|
||||
- or:
|
||||
# external light is LOW (below Helper daylight_luminescence set value)
|
||||
- condition: template
|
||||
value_template: "{{ ( states('sensor.esterno_luminosita_illuminance_lux') | int ) < ( states('input_number.daylight_luminescence') | int ) }}"
|
||||
# after sunrise and before sunset
|
||||
- condition: sun
|
||||
after: sunset
|
||||
after_offset: "-01:00:00"
|
||||
before: sunrise
|
||||
before_offset: "+01:00:00"
|
||||
then:
|
||||
- if:
|
||||
- condition: trigger
|
||||
id:
|
||||
- motion-detected
|
||||
then:
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ dont_disturb_condition }}"
|
||||
then:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: states('dont_disturb_light_brightness')
|
||||
color_temp_kelvin: 2500
|
||||
else:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: 100
|
||||
color_temp_kelvin: 2500
|
||||
|
||||
else:
|
||||
- action: light.turn_off
|
||||
target: !input light_target
|
||||
metadata: {}
|
||||
data:
|
||||
transition: 10
|
||||
|
||||
default:
|
||||
# the motion light is always active
|
||||
- if:
|
||||
- condition: trigger
|
||||
id:
|
||||
- motion-detected
|
||||
then:
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ dont_disturb_condition }}"
|
||||
then:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: states('dont_disturb_light_brightness')
|
||||
color_temp_kelvin: 2500
|
||||
else:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: 100
|
||||
color_temp_kelvin: 2500
|
||||
|
||||
else:
|
||||
- action: light.turn_off
|
||||
target: !input light_target
|
||||
data:
|
||||
transition: 10
|
||||
|
||||
mode: single
|
||||
186
blueprints/automation/homeassistant/motion_light_trix_ng.yaml
Normal file
186
blueprints/automation/homeassistant/motion_light_trix_ng.yaml
Normal file
@@ -0,0 +1,186 @@
|
||||
blueprint:
|
||||
name: Motion-activated-Light NG (trix motion sensors)
|
||||
description: Turn on a light when motion is detected NG (trix motion sensor)
|
||||
domain: automation
|
||||
author: Tiziano Trabattoni
|
||||
input:
|
||||
motion_entity1:
|
||||
name: Motion-sensor1
|
||||
description: First Sensor motion entity
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
device_class: motion
|
||||
domain: binary_sensor
|
||||
motion_entity2:
|
||||
name: Motion-sensor2
|
||||
description: Second Sensor motion entity
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
device_class: motion
|
||||
domain: binary_sensor
|
||||
motion_entity3:
|
||||
name: Motion-sensor3
|
||||
description: Third Sensor motion entity
|
||||
selector:
|
||||
entity:
|
||||
filter:
|
||||
device_class: motion
|
||||
domain: binary_sensor
|
||||
light_target:
|
||||
name: Light
|
||||
description: Entity of the Lamp to be controlled
|
||||
selector:
|
||||
target:
|
||||
entity:
|
||||
domain: light
|
||||
use_sun:
|
||||
name: Sun_driven
|
||||
description: Controlled by sunrise and sunset flag
|
||||
default: on
|
||||
selector:
|
||||
boolean:
|
||||
dont_disturb:
|
||||
name: dont_disturb_light_control
|
||||
description: Controls if lamp brightness has to be reduced to not disturb
|
||||
default: on
|
||||
selector:
|
||||
boolean:
|
||||
no_motion_wait:
|
||||
name: Wait time
|
||||
description: Time to leave the light on after last motion is detected.
|
||||
default: 20
|
||||
selector:
|
||||
number:
|
||||
min: 0
|
||||
max: 300
|
||||
unit_of_measurement: seconds
|
||||
|
||||
# Every motion state change is captured and managed by the script therefore we need to restart by queueing triggers
|
||||
# in this automation the poweroff of light is started only if all managed motion sensor are in clear state (= "off")
|
||||
mode: queued
|
||||
max_exceeded: silent
|
||||
|
||||
triggers:
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity1
|
||||
from: "off"
|
||||
to: "on"
|
||||
id: motion_entity1_on
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity2
|
||||
from: "off"
|
||||
to: "on"
|
||||
id: motion_entity2_on
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity3
|
||||
from: "off"
|
||||
to: "on"
|
||||
id: motion_entity3_on
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity1
|
||||
from: "on"
|
||||
to: "off"
|
||||
id: motion_entity1_off
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity2
|
||||
from: "on"
|
||||
to: "off"
|
||||
id: motion_entity2_off
|
||||
- trigger: state
|
||||
entity_id: !input motion_entity3
|
||||
from: "on"
|
||||
to: "off"
|
||||
id: motion_entity3_off
|
||||
|
||||
variables:
|
||||
use_sun_flag: !input use_sun
|
||||
dont_disturb_flag: !input dont_disturb
|
||||
light_target_var: !input light_target
|
||||
motion_entity1_var: !input motion_entity1
|
||||
motion_entity2_var: !input motion_entity2
|
||||
motion_entity3_var: !input motion_entity3
|
||||
|
||||
actions:
|
||||
- choose:
|
||||
# Conditions for triggering on light
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id:
|
||||
- motion_entity1_on
|
||||
- motion_entity2_on
|
||||
- motion_entity3_on
|
||||
sequence:
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ use_sun_flag }}"
|
||||
then: # Sun and luminescence controlled
|
||||
- if:
|
||||
- or:
|
||||
# external light is LOW (below Helper daylight_luminescence set value)
|
||||
- condition: template
|
||||
value_template: "{{ ( states('sensor.esterno_luminosita_illuminance_lux') | int ) < ( states('input_number.daylight_luminescence') | int ) }}"
|
||||
# after sunrise and before sunset
|
||||
- condition: sun
|
||||
after: sunset
|
||||
after_offset: "-01:00:00"
|
||||
before: sunrise
|
||||
before_offset: "+01:00:00"
|
||||
then:
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ dont_disturb_flag }}"
|
||||
then:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: "{{ states('input_number.dont_disturb_light_brightness') | float }}"
|
||||
color_temp_kelvin: 2500
|
||||
else:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: 100
|
||||
color_temp_kelvin: 2500
|
||||
else: # Always active
|
||||
- if:
|
||||
- condition: template
|
||||
value_template: "{{ dont_disturb_flag }}"
|
||||
then:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: "{{ states('input_number.dont_disturb_light_brightness') | float }}"
|
||||
color_temp_kelvin: 2500
|
||||
else:
|
||||
- action: light.turn_on
|
||||
target: !input light_target
|
||||
data:
|
||||
brightness_pct: 100
|
||||
color_temp_kelvin: 2500
|
||||
|
||||
# conditions for triggering off lights
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
id:
|
||||
- motion_entity1_off
|
||||
- motion_entity2_off
|
||||
- motion_entity3_off
|
||||
sequence:
|
||||
- if:
|
||||
- alias: "None of motion sensor are detected"
|
||||
condition: not
|
||||
conditions:
|
||||
- condition: template
|
||||
value_template: "{{ is_state(motion_entity1_var, 'on') }}"
|
||||
- condition: template
|
||||
value_template: "{{ is_state(motion_entity2_var, 'on') }}"
|
||||
- condition: template
|
||||
value_template: "{{ is_state(motion_entity3_var, 'on') }}"
|
||||
then:
|
||||
- alias: "Wait for delay set before turn off"
|
||||
delay: !input no_motion_wait
|
||||
- alias: "Turn off the light"
|
||||
action: light.turn_off
|
||||
target: !input light_target
|
||||
Reference in New Issue
Block a user