motion light Dual and Trix OK - cleanuo of blueprint directory
This commit is contained in:
148
examples/motion_light_dual_lux.yaml
Normal file
148
examples/motion_light_dual_lux.yaml
Normal file
@@ -0,0 +1,148 @@
|
||||
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
|
||||
Reference in New Issue
Block a user