Wondered if someone might be able to point me in th right direction please…
I use input booleans to trigger some automations, with the automations turning them back off once complete.
With the booleans added to a dashboard and used to start the automations, it shows when an automation’s currently running.
I’ve grouped the toggles like this in my configureation.yaml:
if:
- condition: state
entity_id: group.all_toggles
state: "on"
then:
- service: notify.mobile_app_myphone
metadata: {}
data:
message: Toggle is on
title: Toggle is on
else:
- service: notify.mobile_app_myphone
metadata: {}
data:
message: Toggles are off
title: Toggles are off
Is there a way to include a list of boolean friendly names from the group that are currently on in the notification sent from the automation? Preferably one on each line if possible?
So the notification message would be something like:
These toggles are on:
Toggle 1
Toggle 3
I’ve been searching and trying all sorts of variations, but not managed to figure it out.
Thanks a lot
Yes, however if you trigger from a group, the trigger fires when the first boolean turns on, so it is unlikely to return more than one value unless they are otherwise entrained. As long as at least one boolean is on, the trigger will not fire for subsequent booleans turning on.
If the trigger is individual booleans instead of the group, you can use the select() filter to pull the “on” entities from the list provided by the entity_id attribute.
if:
- condition: state
entity_id: group.all_toggles
state: "on"
then:
- service: notify.mobile_app_myphone
metadata: {}
data:
title: Toggle is on
message: |
{{ expand(state_attr('group.all_toggles', 'entity_id') | select('is_state', 'on'))
| map(attribute='attributes.friendly_name') | join('\n')}}
else:
- service: notify.mobile_app_myphone
metadata: {}
data:
message: Toggles are off
title: Toggles are off
If I might go back a step though… This is so that I can get a notification about any automations that were running as I restart homeassistant.
Triggering on home assistants start, it now lists any that might need attention, which is just what I was hoping for.
It’s not a situation I find/create very often, but it’s good to know when it comes up.
Is there any better way to deal with that though, or any way for home assistant to continue where it left off with any automations after being restarted?