List all sensors unavailable etc

Home Assistant Template
{{ states | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | map(attribute='entity_id') | list | join(', ') }}

Taken from Home Assistant Forums

How to list all sensors with state = ‘unavailable’, ‘none’ or ‘unknown’

Note the array and use of ‘in’ option.