I am having trouble preparing this automation for a blueprint. The automation works fine by itself but when combined with the blueprint it does not work.
I receive the below error when I attempt to create an automation from the blueprint. light.living_room_lamp_left is a valid entity id that I used for testing the original automation (which I disable when testing this blueprint).
Any thoughts?
Error:
2021-01-05 10:22:46 ERROR (MainThread) [homeassistant.components.automation] Blueprint BLUEPRINT NAME generated invalid automation with inputs OrderedDict([('light_brightness', '255'), ('target_lights', OrderedDict([('entity_id', 'light.living_room_lamp_left')]))]): Entity ID entity_id is an invalid entity id for dictionary value @ data['entity_id']. Got None
Blueprint:
The HA File Editor gives this error when I open the blueprint: Error:
unknown tag !<!input> at line 56, column 36:
entity_id: !input 'target_lights'
^
Blueprint:
blueprint:
name: Reset light's brightness and color temperature to your default when it turns
on
description: Resets bulb(s)'s color and brightness when it turns on. Although Home
Assistant has a Default Turn-on Value (https://www.home-assistant.io/integrations/light/#default-turn-on-values)
for lights it does not support color temperature, and some bulbs do not quickly
check when they are first physically powered on versus turned on by automation,
UI, or smart switch.
domain: automation
input:
target_lights:
name: Lights
description: The lights you want to auto reset to default settings when they
turn on.
selector:
target:
entity:
domain: light
light_color_temperature:
name: Color Temperature
description: 'Choose the color temperature. Examples: Cool White: 154; Daylight White: 181; White: 250; Soft White: 370; Warm White: 454'
default: 370
selector:
number:
min: 154.0
max: 500.0
unit_of_measurement: mireds
mode: slider
step: 1.0
light_brightness:
name: Brightness
description: Choose the brightness.
default: 255
selector:
number:
min: 1.0
max: 255.0
mode: slider
step: 1.0
source_url: https://gist.github.com/NobleWolf/ecd60fd4f3540ac1cc1083783d3ba28a
alias: Bulb toggle set to default (Soft White) (BP)
description: 'see blueprint description'
trigger:
- platform: state
entity_id: !input target_lights
from: 'off'
to: 'on'
condition: []
action:
- service: light.turn_on
data:
color_temp: !input light_color_temperature
brightness: !input light_brightness
entity_id: '{{ trigger.entity_id }}'
mode: parallel
max: 100
You are using a Target Selector but handling it like an Entity Selector.
If you use a Target Selector, the key name within the automation is target:
Either change the key name in the automation or use an Entity Selector instead of a Target Selector (but if you do that you will lose the ability to select multiple entities).
Okay, I sort of understand. So to allow the blueprint to work with multiple entities I need to:
Leave the selector as a target > entity > domain: light
input:
target_lights:
name: Lights
description: The lights you want to auto reset to default settings when they
turn on.
selector:
target:
entity:
domain: light
Change the Trigger fromentity_id: !input target_lights totarget: !input 'target_lights'
like below:
Possibly because target doesnât support any other options (like from, to, for). Unfortunately, there are precious few examples in the documentation so the only way one discovers what does or doesnât work is by experimentation.
I was testing to see that if the options were part of the âconditionâ instead of the âtriggerâ it would be valid. But my test showed that moving the options to the âconditionâ did not make the blueprint valid.
So my point is that my test of moving the condition elsewhere did not work. Iâm hoping this will help others in the future, or that you or others would see a mistake that could be corrected.
I achieved the goal of allowing multiple entities by including instructions to add more entities manually separated by a comma. But like @123said in this comment itâs not a user friendly option. Alas, Iâll update it when a Blueprint update comes with that feature.