Hi,
I want to use the forecasted ‘precipitation’ and ‘probability of precipitation’ to make the sprinklers for my lawn smarter. I see other post about this topic, still I struggle. I feel I make a basic failure.
If I go to developer tools, in the template tab I see that my OWM integration pulls the forecast data via API.
Red boxes indicate I get values for ‘precipitation’ and ‘probability of precipitation’ in the forecast.
If I try to extract the individual data and display the values, I get “TRUE” for every field (forecasted day) even if values exist.
In the screenshot I try to extract
value 0, with value 0. Reported output is TRUE → expected TRUE → OK
value 1 with value 0.16. Reported output is TRUE → expected FALSE → NOT OK
My goal is to use it in code like this;
- platform: template
sensors:
precipitation48h:
friendly_name: "Rainy in next 48 Hours"
value_template: >-
{% set p0 = state_attr('weather.openweathermap', 'forecast[0].precipitation') == None %}
{% set p1 = state_attr('weather.openweathermap', 'forecast[1].precipitation') == None %}
{{ 'false' if p0 and p1 else 'true' }}
or even better maybe is to multiply the precipitation * precipitation probability. If the sum of this outcome for P0 and P1 is beyond a certain threshold I want to run a sprinkler cycle.
Q1: What am I doing wrong?
Q2: What code do I need to combine precipitation * precipitation probability?
Thanks!
Regards,
Jules