Hi there,
In one of my automations, I’d like to trigger actions when a state attribute has a certain value.
The values are in a list. Thanks to this post (Templating Help With State Attributes), I was able to use the parse function to read the value using state_attr.
By using the following, I can read the value of condition:
{{ state_attr('weather.my_city_hourly', 'forecast')[0]['condition'] }}
What I want to do is say “if the value of condition is sunny, do something”.
Using is_state_attr without the parsed part works fine (see Templating - Home Assistant):
is_state_attr('device_tracker.paulus', 'battery', 40)
What is the syntax when the value is in a list?
I’ve tried placing , sunny
after condition, with and without brackets, but nothing has worked so far.
Can anyone help me with this?