Hi all, I am working on updating the delivered Motion Light blueprint to use scenes instead of lights, which worked great. I am now trying to add an input to not trigger if the selected light entity is on. I am getting a Message malformed: Expected a dictionary @ data[‘condition’][0] error when saving the automation when using the template. I am not seeing where the error is.
blueprint:
name: Motion-activated Light - Advanced
description: Turn on a light when motion is detected.
domain: automation
author: Home Assistant
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
scene_on_target:
name: Scene On
selector:
target:
entity:
domain: scene
scene_off_target:
name: Scene Off
selector:
target:
entity:
domain: scene
no_motion_wait:
name: Wait time
description: Time to leave the light on after last motion is detected.
default: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
light_to_ignore:
name: Light Check
description: Choose a light that if it is on, do not activate scene
default:
selector:
target:
entity:
domain: light
# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
condition: and
conditions:
- condition: sun
before: sunrise
after: sunset
- condition: state
entity_id: !input light_to_ignore
state: "off"
action:
- alias: "Activate On Scene"
service: scene.turn_on
target: !input scene_on_target
- alias: "Wait until there is no motion from device"
wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- alias: "Wait the number of seconds that has been set"
delay: !input no_motion_wait
- alias: "Activate Off Scene"
service: scene.turn_on
target: !input scene_off_target
Thanks, I am not too worried about it being based off old version as the version I based it off of was 2023.09. Everything works when I remove my light_to_ignore, this is the new part I am trying to add. I changed the input for that to an entity instead of target and still seeing the same error:
blueprint:
name: Motion-activated Light - Advanced
description: Turn on a light when motion is detected.
domain: automation
author: Home Assistant
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
scene_on_target:
name: Scene On
selector:
target:
entity:
domain: scene
scene_off_target:
name: Scene Off
selector:
target:
entity:
domain: scene
no_motion_wait:
name: Wait time
description: Time to leave the light on after last motion is detected.
default: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
light_to_ignore:
name: Light Check
description: Choose a light that if it is on, do not activate scene
default:
selector:
entity:
multiple: true
filter:
- domain: light
# default:
# selector:
# #target:
# entity:
# domain: light
# boolean_offset:
# name: Trigger only when Sun is down
# description: Only activate the scene if the sun is down
# default: false
# selector:
# boolean:
# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
condition: and
conditions:
- condition: sun
before: sunrise
after: sunset
- condition: state
entity_id: !input light_to_ignore
state: "off"
action:
- alias: "Activate On Scene"
service: scene.turn_on
target: !input scene_on_target
- alias: "Wait until there is no motion from device"
wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- alias: "Wait the number of seconds that has been set"
delay: !input no_motion_wait
- alias: "Activate Off Scene"
service: scene.turn_on
target: !input scene_off_target
You’ll wish you had when the code that was changed completes deprecation and it stops working. It’s just a matter of adding the key filter: in a couple of places…
As far as the error goes,
You have to look at the error and figure out which key it is pointing to for the error. It will telly if you look at it, Something like action[0] service[2], etc these count from top to bottom and 0 to how many.
The first error I think pointed to the light_to_ignore input, but you didn’t provide a clue for the second one.
It might have something to do with that you have multiple on, so that makes a list, and not sure that you are expecting a list in the rest of the code.