Garden Irrigation

Not sure exactly what you’re trying to accomplish, but I have a similar controller and wanted to implement a way to shut off watering in the case of rain (or forecast rain). There are certainly new controllers (e.g. Rachio) available that can implement this, so one option is just replace the controller. If I were starting this project today, this is probably what I would do. This would also give me the option to change the watering schedule automatically as well.

However, I implemented this solution four or five years ago, when internet-connected irrigation controllers were still hugely expensive (because they were used in commercial settings). So, here’s what I did.

Most sprinkler controllers (including the Hunter Pro-C) have a connection for a rain sensor. These sensors are really simple devices. They have various different methods of operation, but in the end all they are is a switch. The switch opens or closes based on whether they have been rained on recently.

All I wanted to be able to do is prevent watering when rain had happened recently or was forecast, so I purchased z-wave dry contact relay (today you could use a sonoff, I guess) and wired it up to the rain sensor contacts in my controller. With everything wired up, I can now control whether the scheduled watering program in the controller actually executes.

I wrote a simple automation in HA to detect whether rain is forecast or occurring and use this to drive the switch. Formerly I had a really cool automation using the accumulated rain totals that we provided by WUnderground, but this service is now a paid one, so I’m just using the probability or rain. I’m looking for more elegant solutions (evapotranspiration?), but the solution I have seems to work OK for now. I also have a manual override function (input boolean) that allows me to manually interrupt all watering regardless of the weather forecast.

Not sure if any of this is helpful, but maybe it gives you an idea how to integrate an old irrigation controller with some kind of modern technology.

Hi Cam,

Looking at line 14 I think the issue is that you don’t have the same entities as me. That section of my file is about customising some entities that are created using ESPhome and brought into HA via the ESPhome integration. Your system will no doubt be different in this respect. What you will need to do is create the switch entities for your solenoids. You can do this within the reticulation.yaml file if to keep things neat. Just create a component heading switch: and list your solenoid switch entities.

Here is my latest version which now includes two starts times per Program so that I can have more flexibility with the timing and it’s more like a commercial system.

I do plan to make another change to it this week to convert the use of delays to timers so that I can display time remaining in the GUI.

reticulation.yaml

########################################
#
#   This is a full reticulation
#   control package using ESPHOMEYAML
#   as the soleniod control via a NodeMCU
#
########################################

homeassistant:
  customize:
    switch.retic_station_1_valve:
      icon: mdi:water-pump
    switch.retic_station_2_valve:
      icon: mdi:water-pump
    input_boolean.retic_program1_enable:
      icon: mdi:traffic-light
    input_boolean.retic_program2_enable:
      icon: mdi:traffic-light



      
sensor:
  - platform: template    # determine if today is selected as a watering day for program 1
    sensors:
      retic_program1_watering_day:
        entity_id: input_boolean.retic_program1_monday, input_boolean.retic_program1_tuesday, input_boolean.retic_program1_wednesday, input_boolean.retic_program1_thursday, input_boolean.retic_program1_friday, input_boolean.retic_program1_saturday, input_boolean.retic_program1_sunday, sensor.time
        value_template:  >
          {% set sensor_names = [ 'monday', 'tuesday', 'wednesday','thursday','friday','saturday','sunday'] %}
          {% set today_name = sensor_names[now().weekday()] %}
          {% set entity_id = 'input_boolean.retic_program1_'+today_name %}
          {{ is_state(entity_id, 'on') }}

      retic_program2_watering_day:
        entity_id: input_boolean.retic_program2_monday, input_boolean.retic_program2_tuesday, input_boolean.retic_program2_wednesday, input_boolean.retic_program2_thursday, input_boolean.retic_program2_friday, input_boolean.retic_program2_saturday, input_boolean.retic_program2_sunday, sensor.time
        value_template:  >
          {% set sensor_names = [ 'monday', 'tuesday', 'wednesday','thursday','friday','saturday','sunday'] %}
          {% set today_name = sensor_names[now().weekday()] %}
          {% set entity_id = 'input_boolean.retic_program2_'+today_name %}
          {{ is_state(entity_id, 'on') }}

    
input_datetime:
  retic_program1_start_time_1:    # program start time control
    name: Program 1 Start Time 1
    has_date: false
    has_time: true

  retic_program1_start_time_2:
    name: Program 1 Start Time 2
    has_date: false
    has_time: true

  retic_program2_start_time_1:
    name: Program 2 Start Time 1
    has_date: false
    has_time: true

  retic_program2_start_time_2:
    name: Program 2 Start Time 2
    has_date: false
    has_time: true


input_number:
  retic_program1_station1_run_time:   # station run time control
    name: Station 1 Run Time
    min: 0
    max: 30
    step: 1
    icon: mdi:camera-timer

  retic_program1_station2_run_time:
    name: Station 2 Run Time
    min: 0
    max: 30
    step: 1
    icon: mdi:camera-timer

  retic_program2_station1_run_time:
    name: Station 1 Run Time
    min: 0
    max: 30
    step: 1
    icon: mdi:camera-timer

  retic_program2_station2_run_time:
    name: Station 2 Run Time
    min: 0
    max: 30
    step: 1
    icon: mdi:camera-timer  

  allowable_rain_quantity:
    name: 'Allowable Rain (mm)'
    min: 0
    max: 5
    step: 0.1
    icon: mdi:cup-water

  allowable_rain_percentage:
    name: 'Allowable Rain (%)'
    min: 0
    max: 100
    step: 1
    icon: mdi:water-percent

input_boolean:
  retic_program1_monday:   # watering day selections for program 1
    name: Monday

  retic_program1_tuesday:
    name: Tuesday

  retic_program1_wednesday:
    name: Wednesday

  retic_program1_thursday:
    name: Thursday
    
  retic_program1_friday:
    name: Friday

  retic_program1_saturday:
    name: Saturday
    
  retic_program1_sunday:
    name: Sunday

  retic_program2_monday:   # watering day selections for program 2
    name: Monday

  retic_program2_tuesday:
    name: Tuesday

  retic_program2_wednesday:
    name: Wednesday

  retic_program2_thursday:
    name: Thursday
    
  retic_program2_friday:
    name: Friday

  retic_program2_saturday:
    name: Saturday
    
  retic_program2_sunday:
    name: Sunday


  retic_program1_enable:   # enable program to run
    name: Enable
    
  retic_program2_enable:
    name: Enable


  retic_station_1_run:
    name: Station 1 Run
  
  retic_station_2_run:
    name: Station 2 Run


  retic_rain_parameters_met:   # set to ON if rain today values are below levels set in input_numbers
    name: Rain Parameters Met
    icon: mdi:water
  retic_rain_override:         # set to ON to run retic even if rain parameters are not met
    name: Rain Override
    icon: mdi:water

group:                  # frontend interface setup
  retic_manual:
    control: hidden
    name: 'Manual Control'
    entities:
      - switch.retic_station_1_valve
      - switch.retic_station_2_valve
  
  retic_program1:
    control: hidden
    name: 'Program 1'
    entities:
      - input_boolean.retic_program1_enable
      - script.retic_program1_run
      - input_datetime.retic_program1_start_time_1
      - group.retic_program1_watering_days
      - group.retic_program1_run_times
    
  retic_program2:
    control: hidden
    name: 'Program 2'
    entities:
      - input_boolean.retic_program2_enable
      - script.retic_program2_run
      - input_datetime.retic_program2_start_time_1
      - group.retic_program2_watering_days
      - group.retic_program2_run_times

  retic_program1_watering_days:
    control: hidden
    name: 'Watering days'
    icon: mdi:calendar-multiple-check
    entities:
      - input_boolean.retic_program1_monday
      - input_boolean.retic_program1_tuesday
      - input_boolean.retic_program1_wednesday
      - input_boolean.retic_program1_thursday
      - input_boolean.retic_program1_friday
      - input_boolean.retic_program1_saturday
      - input_boolean.retic_program1_sunday

  retic_program2_watering_days:
    control: hidden
    name: 'Watering days'
    icon: mdi:calendar-multiple-check
    entities:
      - input_boolean.retic_program2_monday
      - input_boolean.retic_program2_tuesday
      - input_boolean.retic_program2_wednesday
      - input_boolean.retic_program2_thursday
      - input_boolean.retic_program2_friday
      - input_boolean.retic_program2_saturday
      - input_boolean.retic_program2_sunday

  retic_program1_run_times:
    control: hidden
    name: 'Run times'
    icon: mdi:camera-timer
    entities:
      - input_number.retic_program1_station1_run_time
      - input_number.retic_program1_station2_run_time

  retic_program2_run_times:
    control: hidden
    name: 'Run times'
    icon: mdi:camera-timer
    entities:
      - input_number.retic_program2_station1_run_time
      - input_number.retic_program2_station2_run_time


automation:
  - alias: Check rain parameters     # check that todays rain doesnt need to disable the retic from running
    initial_state: 'on'
    trigger:
      - platform: template
        value_template: "{{ states('sensor.time') == ((states.input_datetime.retic_program1_start_time_1.attributes.timestamp - 600) | int | timestamp_custom('%H:%M', False)) }}"
      - platform: template
        value_template: "{{ states('sensor.time') == ((states.input_datetime.retic_program1_start_time_2.attributes.timestamp - 600) | int | timestamp_custom('%H:%M', False)) }}"
      - platform: template
        value_template: "{{ states('sensor.time') == ((states.input_datetime.retic_program2_start_time_1.attributes.timestamp - 600) | int | timestamp_custom('%H:%M', False)) }}"
      - platform: template
        value_template: "{{ states('sensor.time') == ((states.input_datetime.retic_program2_start_time_2.attributes.timestamp - 600) | int | timestamp_custom('%H:%M', False)) }}"
      - platform: state
        entity_id: input_number.allowable_rain_quantity
      - platform: state
        entity_id: input_number.allowable_rain_percentage

    action:
      - service_template: >
          input_boolean.turn_{{'on' if states('sensor.bom_perth_rain_today') <= states('input_number.allowable_rain_quantity') and 
                                       states('sensor.bom_perth_forecast_chance_of_rain_0') <= states('input_number.allowable_rain_percentage')  else 'off'}}
        entity_id: input_boolean.retic_rain_parameters_met



  - alias: Reticulation Run Program 1     # start program 1 at designated time if it is enabled and today is selected as a watering day
    initial_state: 'on'
    trigger:
      - platform: template
        value_template: "{{ states('sensor.time') == (states.input_datetime.retic_program1_start_time_1.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
      - platform: template
        value_template: "{{ states('sensor.time') == (states.input_datetime.retic_program1_start_time_2.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: input_boolean.retic_program1_enable
          state: 'on'
        - condition: state
          entity_id: sensor.retic_program1_watering_day
          state: 'True'
        - condition: or
          conditions:
            - condition: state
              entity_id: input_boolean.retic_rain_parameters_met
              state: 'on'
            - condition: state
              entity_id: input_boolean.retic_rain_override
              state: 'on'
    action:
      - service: script.turn_on
        entity_id: script.retic_program1_run

  - alias: Reticulation Run Program 2     # start program 2 at designated time if it is enabled and today is selected as a watering day
    initial_state: 'on'
    trigger:
      - platform: template
        value_template: "{{ states('sensor.time') == (states.input_datetime.retic_program2_start_time_1.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
      - platform: template
        value_template: "{{ states('sensor.time') == (states.input_datetime.retic_program2_start_time_2.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: input_boolean.retic_program2_enable
          state: 'on'
        - condition: state
          entity_id: sensor.retic_program2_watering_day
          state: 'True'
        - condition: or
          conditions:
            - condition: state
              entity_id: input_boolean.retic_rain_parameters_met
              state: 'on'
            - condition: state
              entity_id: input_boolean.retic_rain_override
              state: 'on'
    action:
      - service: script.turn_on
        entity_id: script.retic_program2_run

  - alias: Reticulation Station 1 Run
    initial_state: 'on'
    trigger:
      platform: state
      entity_id: input_boolean.retic_station_1_run
    action:
      - service_template: >
          {% if is_state('input_boolean.retic_station_1_run', 'on') %}
            script.retic_station_1_run
          {% else %}
            script.retic_station_1_stop
          {% endif %}
      
  - alias: Reticulation Station 2 Run
    initial_state: 'on'
    trigger:
      platform: state
      entity_id: input_boolean.retic_station_2_run
    action:
      - service_template: >
          {% if is_state('input_boolean.retic_station_2_run', 'on') %}
            script.retic_station_2_run
          {% else %}
            script.retic_station_2_stop
          {% endif %}

  - alias: Reticulation Controller Offline Alert
    initial_state: 'on'
    trigger:
      platform: state
      entity_id: binary_sensor.retic_controller_status
      to: 'off'
      for:
        minutes: 5
    action:
      - service: notify.pushbullet
        data:
          message: 'Retic Controller Offline!'


script:
  retic_program1_run:             #run retic program 1 through each station for selected time
    alias: Program 1 Run
    sequence:
      - service: switch.turn_on
        data:
          entity_id: switch.retic_station_1_valve
      - delay: "00:00:01"
      - service: switch.turn_on
        data:
          entity_id: switch.retic_bore_control
      - delay: "00:{{ states('input_number.retic_program1_station1_run_time')|int }}:00"
      - service: switch.turn_off
        data:
          entity_id: switch.retic_station_1_valve
      - service: switch.turn_on
        data:
          entity_id: switch.retic_station_2_valve
      - delay: "00:{{ states('input_number.retic_program1_station2_run_time')|int }}:00"
      - service: switch.turn_off
        data:
          entity_id: switch.retic_bore_control
      - delay: "00:00:01"
      - service: switch.turn_off
        data:
          entity_id: switch.retic_station_2_valve
      
  retic_program2_run:             #run retic program 2 through each station for selected time
    alias: Program 2 Run
    sequence:
      - service: switch.turn_on
        data:
          entity_id: switch.retic_station_1_valve
      - delay: "00:00:01"
      - service: switch.turn_on
        data:
          entity_id: switch.retic_bore_control
      - delay: "00:{{ states('input_number.retic_program2_station1_run_time')|int }}:00"
      - service: switch.turn_off
        data:
          entity_id: switch.retic_station_1_valve
      - service: switch.turn_on
        data:
          entity_id: switch.retic_station_2_valve
      - delay: "00:{{ states('input_number.retic_program2_station2_run_time')|int }}:00"
      - service: switch.turn_off
        data:
          entity_id: switch.retic_bore_control
      - delay: "00:00:01"
      - service: switch.turn_off
        data:
          entity_id: switch.retic_station_2_valve

  retic_station_1_run:
    alias: Station 1 Run
    sequence:
      - service: switch.turn_on
        data:
          entity_id: switch.retic_station_1_valve
      - delay: "00:00:01"
      - condition: state
        entity_id: switch.retic_station_1_valve
        state: 'on'
      - service: switch.turn_on
        data:
          entity_id: switch.retic_bore_control
  
  retic_station_1_stop:
    alias: Station 1 Stop
    sequence:
      - service: switch.turn_off
        data:
          entity_id: switch.retic_bore_control
      - delay: "00:00:01"
      - condition: state
        entity_id: switch.retic_bore_control
        state: 'off'
      - service: switch.turn_off
        data:
          entity_id: switch.retic_station_1_valve

  retic_station_2_run:
    alias: Station 2 Run
    sequence:
      - service: switch.turn_on
        data:
          entity_id: switch.retic_station_2_valve
      - delay: "00:00:01"
      - condition: state
        entity_id: switch.retic_station_2_valve
        state: 'on'
      - service: switch.turn_on
        data:
          entity_id: switch.retic_bore_control
  
  retic_station_2_stop:
    alias: Station 2 Stop
    sequence:
      - service: switch.turn_off
        data:
          entity_id: switch.retic_bore_control
      - delay: "00:00:01"
      - condition: state
        entity_id: switch.retic_bore_control
        state: 'off'
      - service: switch.turn_off
        data:
          entity_id: switch.retic_station_2_valve

lovelace

  - title: Retic
    icon: 'mdi:water-pump'
    background: center / cover no-repeat url("/local/images/back_garden_1.jpg") fixed
    cards:
      - type: entities
        show_header_toggle: false
        title: Program 1
        entities:
          - input_boolean.retic_program1_enable
          - script.retic_program1_run
          - input_datetime.retic_program1_start_time_1
          - input_datetime.retic_program1_start_time_2
          - group.retic_program1_watering_days
          - group.retic_program1_run_times
      - type: entities
        show_header_toggle: false
        title: Program 2
        entities:
          - input_boolean.retic_program2_enable
          - script.retic_program2_run
          - input_datetime.retic_program2_start_time_1
          - input_datetime.retic_program2_start_time_2
          - group.retic_program2_watering_days
          - group.retic_program2_run_times
      - type: entities
        show_header_toggle: false
        title: Manual Control
        entities:
          - input_boolean.retic_station_1_run
          - input_boolean.retic_station_2_run
      - type: entities
        title: Rain Settings
        entities:
          - input_number.allowable_rain_percentage
          - input_number.allowable_rain_quantity
          - input_boolean.retic_rain_parameters_met
          - input_boolean.retic_rain_override
        show_header_toggle: false
      - type: entities
        show_header_toggle: false
        title: Status
        entities:
          - entity: binary_sensor.retic_controller_status
            secondary_info: last-changed
          - entity: switch.retic_station_1_valve
            secondary_info: last-changed
          - entity: switch.retic_station_2_valve
            secondary_info: last-changed
          - entity: switch.retic_bore_control
            secondary_info: last-changed
          - binary_sensor.retic_bore_running

3 Likes

Can you help explaining how you are wiring your Sonoff 4ch?

Are you powering your sonoff with the same 24v converter as used to supply the valves?

That helps SO much, I have most of it working, how have you got esp home setup?

I am using a sonoff 4ch with esp home :slight_smile:

I am planning on running the solenoids with a 24vac transformer (i dunno if i will have to mod the relays… i dont think so as they all have com-no-nc connections, and then a little ac-dc converter that ill hopefully be able to fit inside the 4ch to run the logic stuff :slight_smile:

I’ve been following this thread for quite a while and learned a lot. Like may of you, I’m trying to find a way to accurately determine when and how much to water my garden plants. After some reading (including this forum), it seems like the best approach involves somehow determining your evapotranspiration (basically, how much water is lost from your soil due to either evaporation directly into the air or transpiration through the plants and into the air) and then determining how much water you need to add based on a combination of irrigation and rainfall.

Many of you appear to have also landed on this solution. There is then some work to be done to determine the main parameters:

  • What is your evaotranspiration? (specific to your location, soil type, plan type, and weather)
  • How much rainfall has there been?
  • How much water should be added through irrigation?

@hhaim posted some really impressive code to calculate the evapotranspiration and pulled the rainfall data from OpenWeatherMap. His coding skills are far more advanced than mine, but there are a couple of reasons why I’m going a slightly different direction here (I think).

I have been looking for a solution that avoids OpenWeatherMap, mainly because for the last 5 years I’ve had a home-brew irrigation controller running off data that used to be supplied by WUnderground, which suddenly decided they wanted everyone to pay for the data and it wasn’t cheap! Anyway, I prefer to avoid services that might end up being put behind a paywall one day.

Also, the idea of calculating the evapotransiration was a bit above my pay grade (so to speak), so I searched to see if there wasn’t a source that supplied this calculation data already (preferably one that is based on some dataset that isn’t proprietary).

I found the following: https://irrisat-cloud.appspot.com/api#user-account-services. There’s not a lot of detail about this site, but in clicking on the “contact us” link, the two contacts both come from the .edu world, so I am making an assumption that this data is probably non-commercial. Anyway, they don’t require any kind of registration so at least for now it’s free and seems likely to stay that way.

The irrisat API allows you to determine not only today’s evapotranspiration (ET), but also has an ET forecast for the next 8 days. This may be useful because, for example, the historical ET data may indicate a need to irrigate, but a combination of rainfall and lower ET rates in the next few days might mean you don’t need to irrigate, or could irrigate less. At least having the current days ET figure without the need to calculate it (and based on the more accurate Penman–Monteith equation https://en.wikipedia.org/wiki/Penman–Monteith_equation) is something even my limited coding skills can handle. So I made a simple REST sensor in HA for today’s ET figure.

Next, I needed to know about rainfall. You would think this would be easy, but as many of you have figured out getting accumulated rainfall data really takes some sleuthing. OpenWeatherMap will probably do the trick (it is the approach taken by @hhaim, so I assume it works, but I have not tried it) , but as I said I have reservations about building a system on this.

If you are in the USA, however (as I am), it turns out that the government has precipitation data based on a multi-sensor data fusion type model. It’s called the "US National Stage IV& QPE
(Quantitative Precipitation Estimate). There are several versions of the API that I found, but the most useful one (at least for me) is here: https://cida.usgs.gov/thredds/ncss/stageiv_combined/dataset.html

Using this API, I was able to write a simple Python program to pull the previous day’s 1-hour rainfall totals and add them up, giving me the total rainfall yesterday.

That’s where I am at for now. I have the ET sensor set up in HA. Next step is to work on a customer senor to bring in the accumulated rainfall total.

I have never written a custom sensor before, but I’m planning to study @hhaim’s code and see if I can adapt it, combining it with my Python code for the rainfall accumulator. If I can’t figure it out, I’ll be posting somewhere here on the forum for some help on that.

Sorry for the really long post, but I wanted to provide some “bread crumbs” for others to follow who might be looking for some of the online resources I found. Once I have more of this integrated into HA, I’ll hopefully be able to post some code that works to put all of this together.

1 Like

I’m using a NodeMCU (ESP8266) with ESPhome. My system runs using a water bore so has enough water pressure and flow to do my whole property with only 2 stations (hence my code only has 2 stations, although should be very easy for you to expand this out to 4 or more). The NodeMCU has two outputs wired to relays for the 24Vac to power the solenoids and another output wired to a relay which then pulls in a contactor to power the bore. I also included an input on the NodeMCU which is wired to an auxiliary contact on the bore contactor to provide feedback of the contactor state, giving my a ‘running’ feedback.

Hi, can you explain how integrate a rain sensor like hunter (see attachment) to the system?

Have you used an dedicated HW like nodeMCU for this?
Actually i have a sonoff 4ch pro (powered by 220v) with 4 valves (powered by 24vac) . (conversion from an hunter ecologic 4)… But i don’t have idea how to “reuse” my sensor rain.

My idea is using an indipendent nodemcu wired with the sensor wich communicate to HA via MQTT if rain (off) or not rain (on)
So in the main program, before start a program, i need to check first if mqtt topic is on to proceed.
Is it my logic valid?

I’d like to use my actual AC trasformer if it possible (can use 8vac, 12vac, 24vac).

The little rain switch for which you provided a picture is a fairly simple device. Within the switch there is a stack of sponge-like material which has the property that it swells when it gets wet. When rain hits the sensor, this “sponge” soaks up the water and swells. It pushes down on a switch contact which is held lightly in place with a spring. My description may not be that great, but the main point is that when a sufficient amount of water gets into the switch, the switch opens up (i.e. no electrical current can pass between the two wires coming out of the switch). As the sponge dries out, it shrinks and eventually the switch contact closes.

Personally, I have not used a sonoff or nodemcu. They are on my list of things to play around with, but I haven’t had a chance to yet. But you would need some sort of “dry contact” sensor that will allow you to detect when the switch contact in the rain sensor opens and closes and then publish this information to MQTT. I suppose that nodemcu can do this, but again I have no personal experience here.

This is a simple solution to providing some information about rainfall to your system. I personally found this simple solution to be unsatisfying, for the following reasons:

  1. The rain sensor doesn’t provide any input about how much rain has fallen. There is some threshold that must fall to open the sensor, but above this threshold you have no idea whether it rained (for example) 5mm or 55mm. In the former case, perhaps you need to enable watering again in a day or two, but in the second case (55mm rainfall), maybe you don’t need to water again for a week or ??? The simple rain switch won’t give you this information.

  2. The rain sensor can’t detect if it is ABOUT TO rain. Only that it HAS already rained (and even then only if the amount of rain is sufficient to activate the switch). So, for example, there could be monster thunderstorm cell that is just about to hit your lawn, dropping 50mm rain in the next couple of hours, but if the schedule for your irrigation is about to run, it will do so anyway even if the rain switch is working correctly, because it will not have sensed any rain that has occurred.

  3. I have personally found these rain sensors to be unreliable over time. That may just be my bad luck, so YMMV.

For these reasons, I’m working on incorporating a weather forecast as well as actual rainfall data, plus evapotranspiration data. With all of this information, it should be possible to accurately provide just the right amount of water, taking into consideration forecast weather conditions as well as what has already occurred.

This is the dream, anyway. Still working on the implementation! However, your simple approach is a good start. At least it will help prevent gross over-watering.

@smurry have a look here
for a simplified version of Penman’s ET0.
If you provide the numbers into the formula you will see that the difference is not that big betwean Aug (hotest) and Apr, it is maximum factor 2. From my garden experience the diff is bigger than that. So I wouldn’t trust those numbers too much. Another problem with the Service API is the rain estimation. The rain is important not like ET0. in case of the API service that you sent it only provide an estimation (%) were OWP provide actual numbers and there is no replacement for that.
In short, I think that in any case there should be per garden turning into the ET0 calculation so I woudn’t invest much in that.

Hi, @hhaim, Thanks very much for the link to the article. I skimmed it briefly and will dig into it a bit more when I have some time.

I completely agree with your point that ACTUAL rain is certainly much better than ESTIMATED. However, it’s not always quite so easy to obtain actual rainfall. OWM has this, but I suppose the accuracy depends on how close the nearest weather station is, and also the type of rainfall. For example, where I live in the summer we get localized thunderstorms. So, in one location you might receive several tens of mm of rain, whereas in another location only a few km away you might get less, or even none at all. Plus, there is still my lingering mistrust of currently free services that might one day end up costing money (which admittedly is a problem with my rain sensor, too, possibly, but at least the data is from the US gov. so less likely to end up behind a paywall).

FWIW, I’ve been tracking the estimated rainfall totals, based on radar data from the website that I sent before, versus rainfall totals from the nearest weather station. So far, the accuracy is quite good (within 10% on low-rain days and even closer with higher rainfall totals). So, I’m pretty satisfied with this for the time being. Ultimately, my plan will likely be to either buy our build a weather station and use the actual measured rainfall in the irrigation calculations. However, I will likely keep my custom radar-based sensor to be used as a backup in case the local station doesn’t report (or perhaps even embed some sanity-checking so that it will reject outlying datapoints from either sensor if they look improbable). Using your OWM sensor could actually provide an interesting possibility as a kind of “tie-breaker” between the other sensors. That is, if my local sensor reports 10mm rainfall, and the radar sensor report 20mm, and OWM reports 17mm, perhaps I’d use an average or weighted average of the values to get something more likely to be realistic. Something to think about…

I’ve also got my custom evapotranspiration “sensor” based on the irrisat URL I sent earlier running. It’s been in operation for a week or so now and seems to be reporting stable and believable values (i.e. it’s much higher on a hot, dry, windy day and much lower on a cooler, humid day with little wind). So, I’m happy with this for now. I may implement a sensor like you did if this online resource becomes unusable for some reason.

At the moment, I’ve turned my attention to building an ESP-32 based device to control the valves. My current system is not “smart” so in order to implement anything in real life I’m going to have to build something that I can control from HA. Currently, I’ve got a breadboard prototype which accepts MQTT commands to actuate the valves…once the bugs are rung out of this then I’ll turn back to calculating zone watering times using the ET0 and rain sensors. These will no doubt require substantial tuning on a per-zone basis, but I’m fairly confident that this approach will work based on my experience watching the sensors report over the last week or so.

@smurry in regards to the hardware, you can use Sonoff 4ch pro+Tasmota. No need to build something yourself.
The actual rain from OWM is pretty accurate in my case(maybe I’m located near a weather station)
Do you have a year history of ET0, worth verifying the factors between min and max values.

@hhaim,

I don’t have a year of ET0 data (the service I am using only has current and forecast values). In case you’re interested, here is the last 12 days of data that I collected:

Sorry I’m not smart enough to figure out how to summarize these three datasets in one figure! Also sorry for the imperial units :(…

ETo does not seem right. It shouldn’t fluctuate like that with those values. The main factor is average temperature. Higher temperature make ETo higher not lower.
The calculation is not that complex look for pyETo library

@hhaim, thanks. I’m going to keep monitoring this ET0 dataset for a while longer, especially as we begin to heat up for the (northern hemisphere) summer. I agree that the fluctuation seems somewhat odd, although there may be some data integrity issues early in the series (I think I was playing with the algorithm a bit early on).

At some point, however, it’s probably not worth worrying about too much. I did a little test on my main irrigation zone and it deposits roughly 0.6mm water per minute. So, the difference between ET0 of 7mm and, say 5mm is about 3 minutes of watering for a zone. Of course I’d love to “dial in” watering calculation to be absolutely perfect, but at some point I guess you need to say that this is “close enough.” As long as the value properly tracks the increased need for water as we head into the summer, I’ll be happy.

Meantime, I also had a look at the Sonoff 4-ch Pro you recommended. It does look like it would work, with some custom firmware. I may go this route.

Turning on/off a zone from HA should be relatively simple with the Sonoff switch and stock firmware. However, I have concerns about what would happen if the internet connection goes down in the middle of a cycle. Without some custom firmware I suppose the water would keep running until the connection is restored. This could be problematic.

I’ve written some firmware for the ESP32 that connects with an MQTT broker and accepts commands like “water:1:5” meaning water zone1 for 5 minutes. Once the ESP receives this command, it will start an internal timer for the 5 minute duration, then close the valve. If Internet connection is lost during this process, it will continually attempt to reconnect but will also close the valve after 5 minutes whether there is a good connection or not.

The firmware is in test right now. I didn’t have any 3.3v relays, so I’m waiting on my shipment to add actual zone controls (right now all I’m controlling is the little blue LED on the dev board).

For ~USD$10 and a couple of evenings wasted writing uPython I figured I’d go this route before looking harder at the Sonoff or other solutions.

Your questions are good and I’ve solved them. Have a look into how I did that in my GitHub readme.

“I do plan to make another change to it this week to convert the use of delays to timers so that I can display time remaining in the GUI”

You did it? Can you post the solution? Thanks

Hi. I am using the same wired sensor but I have modified it to be RF with following simple steps:

  1. Get the https://www.banggood.com/DIGOO-433MHz-New-Door-Window-Alarm-Sensor-for-HOSA-HAMA-Smart-Home-Security-System-Suit-Kit-p-1388985.html?rmmds=search&cur_warehouse=CN sensor. Open the sensor and remove the magnetic contact wire. Solder the wires from the rain sensor instead. It will act just the same ON/OFF. Stick the soldered and wired unit to rain sensor sensor - somewhere in the AL leg. You need to make it water proof so what I just did is to put the electrical white tape around it and thats it. Or get some small water proof electrical box.
  2. Get the Sonoff RF bridge or similar with custom firmware like Tasmota.
  3. Create binary sensor for example rain switch.
  4. Enjoy

The good thing with this rain sensor is that it act immediately if there is a rain outside. Therefore apart from other rainfall calculations, I have this sensor in my system just to shut down the irrigation - bypass the 24VA transformer.

1 Like

@thoky and @itajackass
This Hunter Mini-Clik looks interesting.

Can you tell me, over what period does it measure the rainfall level. It looks like it is simply a binary on/off sensor based on a level of rainfall but how do you know if that rain was today, yesterday or a week ago.

Sorry if this is a stupid question but it isn’t clear from the website or the Hunter specification sheet.

Thanks.

Hello dears,

could you pls explane, what power/current I need to power eZyvalve 4 Solenoid Valve Box 24V.

i found manual https://antelco.com/assets/products/datasheets/eZyvalve-4-Page-33.pdf which says its current 320,ma. is it true for all four solenoids or just for one of four?