I’m trying to create a blueprint that will toggle a device after a period of time - e.g. turn off a light after it has been on for some time, or turn on a device after it has been off for some time.
I have an automation that works, but turning it into the blueprint below is failing.
When I try to create an automation from the blueprint it says:
2020-12-19 13:10:07 ERROR (MainThread) [homeassistant.components.automation] Blueprint Change device status after period of time generated invalid automation with inputs OrderedDict([('trigger_time', '00:02:00'), ('trigger_device', '91a42907065311ebb26e3548969ee84c'), ('trigger_state', 'on')]): Entity ID 91a42907065311ebb26e3548969ee84c is an invalid entity id for dictionary value @ data['entity_id']. Got None
I’ve seen similar examples using the same input selector (entity) and trigger (state), so why isn’t this one working?
Thanks
blueprint:
name: Change device status after period of time
description: Once a device has been in a set status for a period of time, change it to a new status
domain: automation
input:
trigger_device:
name: Device
description: Which device to monitor?
selector:
entity:
trigger_state:
name: State
description: What state to watch for?
trigger_time:
name: Duration
description: How long to wait before toggling?
selector:
time:
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input trigger_device
to: !input trigger_state
for: !input trigger_time
action:
service: homeassistant.toggle
data:
entity_id: '{{ trigger.entity_id }}'
It probably defaults to device if it can’t find any selectors to match, and I presume there is no ‘entity’ selector, but there’s probably an entity_id selector.
This is guesswork of course because the documentation is woefully lacking on all these subjects.
Reason for asking is that I’m attempting a similar approach, more as a learning exercise in blueprints, but stumble of similar, but not identical, problem. Blueprint error: “…generated invalid automation…”
I’m aware the blueprints are new and not mature in HA, but they seem awfylly picky in what is needed in terms of getting the chain to work: Blueprint authoring might pass the parser, while automation generation still fails…
Debugging information scattered across the system. I’m a strong beliver in blueprints, but they are giving gray hairs for now
Yeah, I think blueprints are a great idea, but for some reason there’s no documentation on what most of the blueprint specific keys mean, or will accept.
target: selector: etc is all just guesswork at the moment. I’m hoping that will change in the near future.
While testing, it updates the automations.yaml file, and it looks like it was creating some dodgy entries in there. I deleted all those that had been added, reloaded automations, and now I can use the blueprint ok!
Does that mean, that although the automations.yaml seems ok, failed blueprint entries will corrupt the file anyway, and only a manual inspection will reveal it?