I use something similar it works with all domains instead of hard coding the media_player domain:
{% set display = ['media_player','sensor'] %} #Change this list to display a different subset of domains.
{% for device in states if device.domain in display -%}
{{ device.entity_id }} ({{ device.state_with_unit.strip() }})
{% for attr in device.attributes | sort() -%}
... {{ attr }}: {{ device.attributes[attr] }}
{% endfor %}
{% endfor %}
Do you just keep these snippets in a text file somewhere and copy and paste when you need them?
I just wanted to make sure I hadn’t missed something stupidly obvious…
I liked the idea of specifying the types you are interested in, thanks @petro!
I made a variant of it to help me get lines to copy/paste into my groups config:
{% set filter = ['sensor','switch','light'] %}
{% for device in states if device.domain in filter -%}
- {{'%-35s'|format(device.entity_id) }} # {{ device.attributes.friendly_name }}
{% endfor %}
Which will produce output like this:
the %-35s sets the string length of the device text so that the comments gets lined up nicely.