I guess there a few ways, but I would define the list of entities (here I called the list âunavailâ) and then use this list the way we have in this post. I have five listed entities here, just change them to what you want:
I modified it to fit in an auto-entities card, by selecting one entity per unavailable device.
type: custom:auto-entities
filter:
template: >
{# Create list of unavailable entities #}
{% set ent_list = [None] + (states
| selectattr('state', 'in', ['unavailable'])
| selectattr('domain','in', ['binary_sensor', 'climate', 'light', 'sensor', 'switch'])
| map(attribute='entity_id')
| list)
%}
{# For each unavailable entity, put it in dict with device name as key
which results in one entity per device #}
{% set tuples = dict( zip( ent_list | map( "device_name" ), ent_list )) | items | list
| select(attribute=0)
| list
%}
{# Print it, removing the first None line #}
{{ dict(tuples[1:]).values()
| sort
| join('\n')
}}