Need help with getting entity values from a string

Hi,

currently I have a group of sensors and I would like to understand, how I could use that.

My code looks like this:

{% for e in expand('sensor.all_sensors') %}
  {{ e.name }} -- {{e.entity_id}}  -- {{e.entity_id.temperature}}
  {{ states('e.entity_id')  }}  
  {{ state_attr( ' ({{e.entity_id}}) ','status') }}
{% endfor %}

In the dev tools it results in:

 R03 Temperature -- sensor.r03_temperature  -- 
  unknown  
  None

  R02 Temperature -- sensor.r02_temperature  -- 
  unknown  
  None

  R01 Temperature -- sensor.r01_temperature  -- 
  unknown  
  None

What is currently in the loop is just trial&error. My goal is just to access and maybe list a specific attribute of the entities in the group.

Is there a way to get from the group to the name of the sensors in there, to the sensor entities itself and then to the attributes of the sensor entities?

{% for e in expand('sensor.all_sensors') %}
  {{ e.name }} -- {{e.entity_id}}  -- {{e.entity_id.temperature}}
  {{ states(e.entity_id)  }}  
  {{ state_attr(e.entity_id,'status') }}
{% endfor %}
1 Like

Thanks a lot.

Iā€™m pretty sure that I tried that as well, but had no luck. Now this works fine.