I’ve created my first blueprint, and created an automation off it.
Using the trace, it seems to do exactly what I want. But - the light never turns on, even though the trace says it tried to:
Executed: August 23, 2023 at 9:26:07 AM
Result:
params:
domain: light
service: turn_on
service_data:
color_temp: 415
brightness_pct: 80
device_id:
- light.light_bulb_table
target:
device_id:
- light.light_bulb_table
running_script: false
I can switch the light on and off with a simple button toggle. So the light is working. But when this script runs, and the trace indicates it send a ‘turn on’ call to the service - the light just remains off. Can you spot an obviuous error?
The full blueprint:
blueprint:
name: Toggle Light on Motion and Lux
description: Toggles a light based on motion detection and the current Lux value
domain: automation
author: Craig Lister
input:
light_target:
name: Light
selector:
entity:
temperature:
name: Lightbulb Colour
selector:
color_temp:
default: 415
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
lux_entity:
name: Lux Sensor
selector:
entity:
domain: sensor
device_class: illuminance
lux_value:
name: Lux Value
description: The maximum Lux value for the event to trigger
default: "50"
wait_time:
name: Wait Time
description: Time to leave the light onn after motion was last detected
selector:
number:
mode: slider
min: 0
max: 3600
unit_of_measurement: seconds
default: 120
mode: single
trigger:
- platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
id: "on"
- platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
id: "off"
for:
hours: 0
minutes: 0
seconds: !input wait_time
condition: []
action:
- if:
- condition: trigger
id: "on"
- condition: numeric_state
entity_id: !input lux_entity
below: !input lux_value
then:
- service: light.turn_on
data:
color_temp: !input temperature
brightness_pct: 80
target:
device_id:
- !input light_target
else:
- service: light.turn_off
data: {}
target:
device_id:
- !input light_target