Hoping someone can help me unpick this issue.
Have a file sensor which contains dates for next rubbish collection. Template editor defines it as a dict, so I believe it’s being parsed correctly.
{
"garbage": "21/12/2021",
"recycling": "21/12/2021",
"green_waste": "28/12/2021"
}
Sensor is called rubbish_collection so when I put {{ states.sensor.rubbish_collection.state }}
in the template editor it’s showing correctly. Trying to get the values of each of the attributes in the object so I can test which one is coming up next and show something different in Lovelace depending. But basic tests aren’t working.
Tried everything
{{ states.sensor.rubbish_collection.state.garbage }}
{{ states.sensor.rubbish_collection.state['garbage'] }}
{{ states.sensor.rubbish_collection.state[garbage] }}
{{ states.sensor.rubbish_collection.state.[garbage] }}
Returns blank or error
{% set value_json = states.sensor.rubbish_collection.state %}
{{ value_json.garbage }}
{{ value_json.[garbage] }}
Interestingly when I do
{% set value_json = states.sensor.rubbish_collection.state %}
{{ value_json[1] }}
I get a single ’ back, type String. Does this mean it’s not parsing correctly. Checked the data file and it’s correctly marked as ".
Still quite new to objects/dict in Python.