Smart Sprinkler Automation (skip watering if there is rain in next 48 hours - 2 days)

I haven’t upgraded to 0.115.2 yet. I’ll do it today and will let you know.

Just checked and I have the same problem! we need to report the issue.

Issue reported.

Thanks, appreciate that.

Thank you to @arvage and @123 for this post. I’m new to HA (and Python, YAML, Jinja and the template language) so this post helped me a lot in getting my watering system going. I ran into a few problems and I thought I’d share the details in case it helps any other newbies.

The first problem is that (for me) forecast precipitation is always null so the only useful forecast value is condition, I’m using the next 4 days with this code:

  - platform: template
    sensors:
      rainy_day:
        friendly_name: "Rain in next 48 Hours"
        value_template: >-
          {% set p0 = state_attr('weather.openweathermap', 'forecast')[0].condition == 'rainy' %}
          {% set p1 = state_attr('weather.openweathermap', 'forecast')[1].condition == 'rainy' %}
          {% set p2 = state_attr('weather.openweathermap', 'forecast')[2].condition == 'rainy' %}
          {% set p3 = state_attr('weather.openweathermap', 'forecast')[3].condition == 'rainy' %}
          {{ 'Yes' if p0 or p1 or p2 or p3 else 'No' }}

image

forecast precipitation is always null unless there will rain.

I see there is now a PR to have this fixed? https://github.com/home-assistant/core/pull/39839

I put the pull request and they were working on It. Not sure if it’s been applied to the HA yet. I’m getting null on precipitation which is correct for when there is no rain so maybe they did. I have to check.

No, not yet. You can see this by looking at the temperature low forecast, which also and still is “unknown” (same bug, same fix)

This looks rather promising… How can i import the .yaml filesin my home assistant? I tried importing the blue prints but it’s giving me errors.

I’ve got a setup like this where i want to automate the watering, between May and Oktober with a groundwater pump on a smart switch.

This sort of thing should be available to all users! This is where “Blueprints” come in handy. This should be made into a blueprint!

I was using ‘arvage’ logic since last year and worked like a charm until now, when sprinklers season starting, i see error message in HA log as below. Any clue how to fix it?

TemplateError('UndefinedError: None has no element 0') while processing template 'Template<template=({% set p0 = state_attr('weather.openweathermap', 'forecast')[0].condition == "rainy" %} {% set p1 = state_attr('weather.openweathermap', 'forecast')[1].condition == "rainy" %} {{ 'Tak' if p0 and p1 else 'Nie' }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.czujnik_deszczu'

Hello bazuka,
I stopped using openweathermaps last year as they stopped providing required info. I have to look into their new formats and check if I can figure out what has changed.
Let me know if anyone already have a solution.