Hello!
I’m losing my marbles with this blueprint. I want it to turn the downstairs lights on when motion is detected, but only when the room gets below 150lux, and between sunrise and sunset (with an offset).
blueprint:
name: Motion/Sun-activated Light with illuminance
description: Turn on a light when motion is detected, illuminance is below a
set Lux level, and during sunlight hours.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
multiple: true
lux_entity:
name: Illuminance Sensor
selector:
entity:
domain: sensor
device_class: illuminance
multiple: false
lux_level:
name: Illuminance level
description: If lux is below this value and motion is detected, the light will
turn on.
default: 100
selector:
number:
min: 0.0
max: 1000.0
step: 1.0
mode: slider
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: 120
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
step: 1.0
mode: slider
brightness:
name: Light brightness
description: The brightness of the lights.
default: 254
selector:
number:
min: 5.0
max: 255.0
step: 1.0
mode: slider
sunset_offset:
name: Offset to turn off lights
description: Offset before sunset
default: 60
selector:
number:
min: -60
max: 60
unit_of_measurement: minutes
sunrise_offset:
name: Offset to turn on lights
description: Define offset after sunrise
default: 45
selector:
number:
min: -60
max: 60
unit_of_measurement: minutes
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input 'motion_entity'
from: 'off'
to: 'on'
condition:
condition: and
conditions:
- condition: numeric_state
entity_id: !input 'lux_entity'
below: !input 'lux_level'
- condition: or
conditions:
- condition: sun
after: sunrise
after_offset: !input sunrise_offset
- condition: sun
before: sunset
before_offset: !input sunset_offset
action:
- service: light.turn_on
data:
brightness: !input 'brightness'
target: !input 'light_target'
- wait_for_trigger:
platform: state
entity_id: !input 'motion_entity'
from: 'on'
to: 'off'
- delay: !input 'no_motion_wait'
- service: light.turn_off
target: !input 'light_target'
What am I missing?