My Garden Irrigation

OK, I got it - hope I am not wrong :grinning:

  • platform: template
    sensors:
    rainfall:
    friendly_name: Rainfall
    value_template: “{{ (states(‘sensor.dark_sky_precip_intensity_0d’)|float *24) | round(1)}}”
    unit_of_measurement: “mm”

yes, I left 2 lines. I fix it. Sorry :upside_down_face:

No problem :grinning:
Do you have a fix for yesterday sensor too ?

Just replace “sensor.dark_sky_forecast_daytime_high_temperature_0d” to “sensor.rainfall” in this 2 files:

sensors.yaml

- platform: template
  sensors:
    rain_minus0:
      friendly_name: Rain today
      value_template: "{{ states('sensor.rainfall') }}"
      unit_of_measurement: "mm"

    rain_minus1:
      friendly_name: Rain yesterday
      value_template: "{{ states('input_number.rain_minus1') }}"
      unit_of_measurement: "mm"

    rain_minus2:
      friendly_name: Rain 2 days ago
      value_template: "{{ states('input_number.rain_minus2') }}"
      unit_of_measurement: "mm"

    rain_minus3:
      friendly_name: Rain 3 days ago
      value_template: "{{ states('input_number.rain_minus3') }}"
      unit_of_measurement: "mm"

scripts.yaml

garden_rainfall_data:
  sequence:

    # Cycle the rainfall figures.
    # Passed {{ loop_count}} which is the number relating to the highest entity
    # e.g. input_number.rain_minus3

    # Now using sensor.smartweather_rain_yesterday
    # Make todays rain zero

    - service: input_number.set_value
      data_template:
        entity_id: >
          input_number.rain_minus{{ loop_count }}
        value: >
          {% if loop_count | int == 0 %}
            0
          {% elif loop_count | int == 1 %}
            {{ states('sensor.rainfall') }}
          {% else %}
            {{ states('input_number.rain_minus' ~ (loop_count | int - 1) | string) }}
          {% endif %}
    # # Stop when count is 0
    # - condition: template
    #   value_template: >
    #     {{ loop_count | int > 0 }}

    # Stop when count is 1 because day zero is rain today which
    # is collected directly from the sensor.smartweather_rain_today
    - condition: template
      value_template: >
        {{ loop_count | int > 1 }}
    # Stop the looping script...
    - service: homeassistant.turn_off
      entity_id: script.loop_garden_rainfall_data

    # ...before looping
    - service: script.loop_garden_rainfall_data
      data_template:
        loop_count: >
          {{ loop_count }}
2 Likes

Thank you :+1:t3:
Just to be clear - the second file in your example (scripts.yaml) is for temperature not rainfall. Did you mean to create the same instance calculation for rainfall too? Because if I replace the dark_sky temp sensor there with rainfall sensor we it will not count the temp anymore.
Sorry If this may be a stupid questions but I want to be sure.

You’re right! I did not pay attention to copying the temperature. But it turned out that my configuration was bad, because I was watching a bad sensor. But it worked. :sweat_smile::joy:
I fix it. THX :beers:

:grinning: :beers:

:slightly_smiling_face: Hope this may be help-full:

If you are using the Netatmo weather station with Rain Gauge sensor, I found that this trigger needs to be changed because the sensor sum_rain_24 (Rainfall in mm from 00:00am - 23:59pm) stops the cycle at 23:59 and makes the sensor 0 for next day…

#================================================
#=== Collect new and cycle historic weather data
#================================================

  • alias: Irrigation Weather Data - Collect new and cycle historic weather data
    initial_state: ‘on’
    trigger:
    • platform: time
      at: ‘23:45:00’ -> from 01:00:00
1 Like

Hi.
Still waiting for my sonoff 4ch pro r2 to come, but meanwhile I read part of this discussion and Iwanted to try your package.
Imported it without problems.
Then I “took control of my UI” and open raw cfg for the first time.
I pasted your lovelace config at the end and saved, but I get errors and nothing shown.
What did I do?

You need to include this plugin

thank you very much for pointing me in the right direction.
I did the same with all the other custom components, now it looks clean.
There’s still a missing card, I’ll look into it

Can I ask if anyone has been using the weather calculations to adjust watering times?
If so, are you happy they give sensible adjustments and what thresholds are you using?

Thanks.

No… actually i’ve deleted this part of the script cause i’d like to convert MORNING CICLE and AFTERNOON CICLE in a scenario like PROGRAM A, B, C, D… where each program can run 3 different times during a day…and each program can run every day, alternate day, or none.
I’d like to convert in this way to simulate a real irrigation system like Hunter eco-logic or others brands… And cover scenario where I have strawberry / raspberry and other that need microirrigation more times in the same day… And garden only one times a day… Or every 2 days

So… I remove temporary your wheater adj. Script to simplify my work :frowning:

I have been using it for over 2 months and everything works perfectly, in these days I have raised the temperature of the “baseline temperature” to (26) since in my part these days the temperature is about 38 degrees, and the automatic adjustment brought at 8-9 minutes of irrigation that honestly were too many. I take this opportunity to share the “Itajackass” modifications to be able to carry out more daily irrigations and maybe alternately or otherwise it would be perfect.

I’m still waiting for my sonoff 4ch, meanwhile I didn’t find time to explore and test the program.
But I see that all temperature and rainfall history are 0.
Darksky is configured and running. Should I enable something specific to have history working?

Today i got a strange problem. I opened my dashboard and i’ve seen that scheduler (both for morning and afternoon) was off. They was ON until yesterday i’m sure.
I reenabled one (morning) at 06:00 daily (so next run is 2 july 06:00 am) BUT the system started today 1 july at about 18:15…!!! I don’t know the problem… Any suggest? See attachment

Ok, sonoff 4ch R2 arrived, I just gave to its switches the same valve names that you used, and it work.
Manual and scheduled moning&afternoon cycles are working and relais are triggered at specified times and using specified duration.
I added earlier times for morning and later times for afternoon.
Perfect. It can already do what my current irrigation system can do, so i think that soon I will replace it.

I’m not sure if I will use weather adjustement or not, I’d like to observe what it does for a few day before chosing.
I have a problem that is preventing me to check this data… histories are not present, they all show zero.

On more, and probably most important, thing is that on reboot schedules get turned off.
Zone duration and schedule settings are still there, but simply schedules are turned off.

Same problem for me. Scheduler doesn’t save the state on reboot

I’s strange, they are input_boolean, and input_boolean’s state is restored at boot, at least for my other input_boolean entities…

Found. Just comment this 2 lines.
There a problem in the master switch

2 Likes