@klogg wrote:
Is it possible to template on arrays of attributes? (I think I have the terminology right )
I know I can do this:
{% set sensor_id= '1' %} {% set my_value = state_attr('sensor.my_sensor_' ~ sensor_id, 'my_attribute') %}
But what if the attributes are an array? As far as I am aware the only way to extract these is to use the form:
{% set my_value = states.sensor.my_sensor_1.attributes.array[0].my_attribute %}
What I’d like to be able to do is this (which obviously doesn’t work and neither do the many other forms I’ve tried)
{% set my_value = states.sensor.my_sensor_{{ sensor_id }}.attributes.array[0].my_attribute %}
Is there a way to do this?
Thanks
Posts: 1
Participants: 1