Unavailable / Unknown Entity Monitoring - Template Sensor

thanks for the link to here Marc, there was a parallel thread yesterday:

as you can see, the same base template is used:

 value_template: >
        {{ states | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | list | length }}
      attribute_templates:
        entities: >
          {{ states | selectattr('state', 'in', ['unavailable', 'unknown', 'none'])| map(attribute='entity_id')  | list | join(',\n ') }}

As asked in the other thread: would you know of a way to group the sensors listed by the state? (‘unavailable’, ‘unknown’, ‘none’).

Petro suggested the |groupby('state') but that doesn’t work unless I take out the map(attribute='entity_id'), and even then renders the list complete with all attributes… not what I need.