First off; I am not a programmer. I was happily living my 300+ Automations with the gui and everything works. Now I am forced to get a number from inisde an atttribute and after hours and hours of googling and searching I am not seeing any success. Which is hard as I really don’t know what {{, {% and the likes do. Might as well be ancient egyptian algebra.
So I have the DWD Weather integration. Which work. Inside that sensor is a wealth of information. I need the “todays high temperature mark” which resides in Attribute forecast, then the first, say, array index unter temperature.
I whacked it for a good few hours until the template development tool gave me “23” which is the highest temp for today. This is what I came up with:
So if you paste {{ (states('weather.dwd_weather_solingen_hohenscheid.attributes.forecast[0].temperature') | int) > 22 }} into the template editor - it should return true or false - or an error. What does it do?
So that’s because your sensor for some reason did’t provide a value??? Weird. You can provide a default by changing int to someone like int(22) but not sure why your sensor suddenly returned unknown.
You are mixing complete yaml with part yaml… it’s hard to give words to it.
The code you got before from Daryl was complete code, you need to go to the top right corner, yaml mode.
Now the GUI is gone and you can edit the complete automation in yaml.
What you did was click on the part in yaml mode and pasted a complete yaml part…
Also you are mixing up your template values - I copied yours which won’t work, the one you pasted in the template editor (which is different) will work.
Rather than use either - in the editor replace value_template etc with @Troon suggestion: