The documentation for the new multiple attribute of a selector in blueprints is missing how to use the list of entities in the action/condition part.
Obviously everything used to be working for only one device, but how does a state trigger or a condition work for a list of entities? Particular in this area of my automation/blueprint:
trigger:
- platform: state
entity_id: !input 'window_entities'
to: 'on'
action:
[...]
- wait_for_trigger:
- platform: state
entity_id: !input 'window_entities'
to: 'off'
continue_on_timeout: false
I havenât really tested it yet, but does this even work? And will it trigger when one of the list members switches to âonâ or only when all of them switch to âonâ? How do I achieve either version?
No, I havenât. But as far as I remember that was not the issue. The issue is how to pass a list of entities that were defined by the user creating the automation with the blueprint into the condition/wait_for_trigger part. Do you have any suggestion how to change the action part to make use of match: any?
A selector with multiple set to true defaults to any for a true evaluation.
So if used in a condition, it will evaluate to true if just one of the entries in the selector is true. This means a false condition requires all entries to be false.
To have the condition use all to be true instead of any requires some more work.
Hereâs how I did it. In my case I had multiple (boolean) sleep triggers (stored in variable sleep_triggers) that ALL had to evaluate to true (on) to trigger an action.
What this means is I expand the list of sleep_triggers and then check if the amount that have their state set to âoffâ is zero. This way I know theyâre all set to âonâ, no matter how many entries there are.