Hi all ,
I have created a blueprint and everything appears to be working correctly, except for when I try to add optional conditions to the predefined conditions. Whenever I include the input for additional_conditions, the automation fails because of an extra indent on the additional_conditions line. I am having trouble figuring out where I am making the mistake.
Snip from blueprint
blueprint:
name: Motion-Activated Light Dimmer
description: Turn on a light when motion is detected, with dimming functionality.
domain: automation
author: dawsnet
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class:
- motion
- door
- occupancy
lux_entity:
name: Light Level Sensor
selector:
entity:
domain: sensor
device_class: illuminance
lux_value:
name: Lux Level
description: Light level threshold to trigger motion
default: 500
selector:
number:
min: 0
max: 15000
unit_of_measurement: lx
additional_conditions:
name: Additional Conditions
description: Extra conditions to consider for this automation
default: []
selector:
condition:
block_conditions:
name: Block Conditions
description: An condition to blcok this automation from turning off the lights
default: []
selector:
condition:
light_target:
name: Light
description: traget light to be switch on or off
selector:
entity:
domain: light
evening_brightness_target:
name: Evening Time Brightness
description: Brightness level for evening hours
default: 100
selector:
number:
min: 0
max: 255
night_brightness_target:
name: Night Time Brightness
description: Brightness level for night hours
default: 10
selector:
number:
min: 0
max: 255
no_motion_wait:
name: No Motion Wait Time
description: Time to keep the light on after last motion detection.
default: 5
selector:
number:
min: 0
max: 30
unit_of_measurement: minutes
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input motion_entity
to: "on"
id: motion
- platform: state
entity_id: !input motion_entity
to: "off"
for:
minutes: !input 'no_motion_wait'
id: non_motion
action:
- choose:
- conditions:
- condition: trigger
id: motion
- condition: state
entity_id: input_boolean.night_mode
state: "on"
- condition: numeric_state
entity_id: !input lux_entity
below: !input lux_value
- condition: !input additional_conditions
sequence:
- service: light.turn_on
target:
entity_id: !input light_target
data:
brightness: !input night_brightness_target
- conditions:
- condition: trigger
id: motion
- condition: state
entity_id: input_boolean.night_mode
state: "off"
- condition: numeric_state
entity_id: !input lux_entity
below: !input lux_value
- condition: !input additional_conditions
sequence:
- service: light.turn_on
target:
entity_id: !input light_target
data:
brightness: !input evening_brightness_target
- conditions:
- condition: trigger
id: non_motion
- condition: state
entity_id: !input light_target
state: "on"
- condition: !input block_conditions
sequence:
- service: light.turn_off
target:
entity_id: !input light_target
Snip from an automation that failed
action:
- choose:
- conditions:
- condition: trigger
id: motion
- condition: state
entity_id: input_boolean.night_mode
state: 'on'
- condition: numeric_state
entity_id: sensor.out_side_lux
below: 1770
- condition:
- condition: state. # <<<<< extra indent
entity_id: media_player.tv_samsung_7_series_55
state: 'off'
sequence:
- service: light.turn_on
target:
entity_id: light.kitchen_dining
data:
brightness: 10