Hello HA-Friends,
I am desperately trying to create a “precipitation_probability” template sensor for my weather forecast integration “DWD”.
This is how all attributes of my entity “weather.dwd_weather_city” look like:
temperature: -0.2
humidity: 77
pressure: 1022.4
wind_bearing: 297
wind_speed: 27.8
visibility: 38.8
forecast:
- datetime: '2022-01-20T00:00:00Z'
condition: partlycloudy
temperature: 1
templow: -1
precipitation: 0.6
precipitation_probability: 72
- datetime: '2022-01-21T00:00:00Z'
condition: sunny
temperature: 2
templow: -4
precipitation: 1.4
precipitation_probability: 81
- datetime: '2022-01-22T00:00:00Z'
condition: rainy
temperature: 5
templow: 3
precipitation: 6.1
precipitation_probability: 80
As you can see, the “precipitation_probability” per day (today, tomorrow, day after tomorrow) is a child of the attribute “forecast” restricted by a “datetime”.
I was able to “filter” out the forecast-attribute by templating like this:
{{ (state_attr("weather.dwd_weather_city", "forecast"))}}
But the problem remains, that I can not extract the “precipitation_probability” of todays “datetime”.
Maybe some templating/jinja2-expert may help me with this problem?
Would be great, thanks in advance!
Best Regards