Hello,
I try to access the values in my entities via template.
The entity looks like this:
I created the values via the customize.yaml:
sensor.lena_steckdose_power:
max: 100
severity:
- from: 0
to: 20
color: Green
- from: 100
to: 1000
color: Red
I try to get the values defined in the severity attribute
{%for sev in state_attr('sensor.lena_steckdose_power','severity')%}
{{sev}}
{%endfor%}
Then I get the following output:
OrderedDict([('from', 0), ('to', 20), ('color', 'Green')])
OrderedDict([('from', 100), ('to', 1000), ('color', 'Red')])
I am not sure how to get the values direclty like severity[0] or something similar.
The best way would be to get the whole severity as a json. Is there any function to get this?