Hey everyone,
I’m kind of new to Home Assistant, I just migrated from Fibaro Home Center 2, and really happy so far!
I was playing with blueprints, and wanted to build one, based on a built-in one (motion-activated light) but taking into account that a button can be pressed in-between.
Here’s what I came up with:
blueprint:
name: Motion-activated Light with button
description: Turn on a light when motion is detected.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
filter:
device_class: motion
domain: binary_sensor
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
max: 3600
unit_of_measurement: seconds
# 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"
action:
- alias: "Turn on the light"
service: light.turn_on
target: !input light_target
- alias: "Wait until there is no motion from device or light turned off manually"
wait_for_trigger:
- platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- platform: state
entity_id: !input light_target
to: "off"
- if:
- condition: state
entity_id: !input light_target
state: "off"
then:
- stop: ""
else:
- alias: "Wait the number of seconds that has been set or light turned off manually"
wait_for_trigger:
- platform: state
entity_id: !input light_target
to: "off"
timeout: !input no_motion_wait
continue_on_timeout: true
- if:
- condition: state
entity_id: !input light_target
state: "off"
then:
- stop: ""
else:
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target
However, when I try to use it, there is an error message saying:
Message malformed: Entity entity_id is neither a valid entity ID nor a valid UUID for dictionary value @ data[‘action’][2][‘if’][0][‘entity_id’]
I spent quite some time trying to understand, google, etc. to no avail.
Any hint on what could be wrong with entity_id: !input light_target
apparently.
Thank you for your help!