How to recover Attributes Details in Jinja


I would like to get in a notification on my phone the various details that I am seeing in the attribute of a sensor. For example:

I not a complete newbie but I far from experienced. I have managed to create notifications with a simple Jinja like:
message: {{states('’)}}

But how to catch more than just state? Is it possible?

Does anyone has an idea? Hope you understand :slight_smile:


if you want all the attributes you could do this:

% set entity_id = 'input_number.test_number' -%}
{%- for attr in states[entity_id].attributes -%}
{{ attr }}: {{ state_attr(entity_id, attr)}} {{ '\n' }}
{%- endfor %}

if you want to select specific ones, then use this instead:

{{ state_attr('', 'attribute_name') }}

As easy as that. Works like a charm. Thanks a lot!
Have a good week end