Hi,
I am having some trouble with a blueprint that i modified last night. I am trying to add a condition to an action but not having much luck.
I have duplicated and modified the included ‘Motion-activated Light’ blueprint to include a condition for after sunset and also only to turn off if a switch is off.
The logical process is: motion is detected > Check if after sunset > Turn on light > Check if manual override switch is off > Delay for X time > Turn Off
If the manual override switch is ON then I do not want it to proceed and to end the automation. This is easy to do with 2 automation but I like the simplicity of using blueprints going forward.
Here is my blueprint:
blueprint:
name: Motion-activated Light (After Sunset with Override)
description: Turn on a light when motion is detected after sunset.
domain: automation
#Modified from source_url: https://github.com/home-assistant/core/blob/3ae527c1585d7384688a512ffcf92293999ad749/homeassistant/components/automation/blueprints/motion_light.yaml
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
light_target:
name: Light
selector:
target:
entity:
domain: light
manual_override:
name: Manual Override
description: When the manual override is switched on the light will stay on.
selector:
target:
entity:
domain: input_boolean
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"
condition:
- condition: or
conditions:
- condition: sun
after: sunset
- condition: sun
before: sunrise
action:
- service: light.turn_on
target: !input light_target
- wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- condition: state
entity_id: !input manual_override
state: 'off'
- delay: !input no_motion_wait
- service: light.turn_off
target: !input light_target
If i hash out this it will work fine, obviously without the manual override check:
- condition: state
entity_id: !input manual_override
state: 'off'
And the Automation:
- id: '1611050128472'
alias: LIGHTS - Deck Path 1 (Stair Zone)
description: ''
use_blueprint:
path: homeassistant/motion_light_options.yaml
input:
no_motion_wait: '120'
light_target:
entity_id:
- light.deck_path_light_1
manual_override:
entity_id: input_boolean.lights_all_back_keep_on
motion_entity: binary_sensor.deck_stairs_ai_zone
And the error:
Logger: homeassistant.components.automation
Source: components/automation/__init__.py:517
Integration: Automation (documentation, issues)
First occurred: 9:37:34 AM (4 occurrences)
Last logged: 9:37:34 AM
Blueprint Motion-activated Light (After Sunset with Override) generated invalid automation with inputs OrderedDict([('no_motion_wait', '120'), ('motion_entity', 'binary_sensor.deck_path_1_ai_zone'), ('light_target', OrderedDict([('entity_id', ['light.deck_path_light_1'])])), ('manual_override', OrderedDict([('entity_id', 'input_boolean.lights_all_back_keep_on')]))]): Entity ID entity_id is an invalid entity id for dictionary value @ data['action'][2]['entity_id']. Got None
Blueprint Motion-activated Light (After Sunset with Override) generated invalid automation with inputs OrderedDict([('no_motion_wait', '120'), ('motion_entity', 'binary_sensor.deck_path_2_ai_zone'), ('manual_override', OrderedDict([('entity_id', 'input_boolean.lights_all_back_keep_on')])), ('light_target', OrderedDict([('entity_id', 'light.deck_path_light_2')]))]): Entity ID entity_id is an invalid entity id for dictionary value @ data['action'][2]['entity_id']. Got None
Blueprint Motion-activated Light (After Sunset with Override) generated invalid automation with inputs OrderedDict([('no_motion_wait', '120'), ('motion_entity', 'binary_sensor.deck_path_3_ai_zone'), ('manual_override', OrderedDict([('entity_id', 'input_boolean.lights_all_back_keep_on')])), ('light_target', OrderedDict([('entity_id', 'light.deck_path_light_3')]))]): Entity ID entity_id is an invalid entity id for dictionary value @ data['action'][2]['entity_id']. Got None
Blueprint Motion-activated Light (After Sunset with Override) generated invalid automation with inputs OrderedDict([('no_motion_wait', '120'), ('light_target', OrderedDict([('entity_id', ['light.deck_path_light_1'])])), ('manual_override', OrderedDict([('entity_id', 'input_boolean.lights_all_back_keep_on')])), ('motion_entity', 'binary_sensor.deck_stairs_ai_zone')]): Entity ID entity_id is an invalid entity id for dictionary value @ data['action'][2]['entity_id']. Got None
Any help is greatly appreciated. Thanks!
David