Garden Irrigation

Hello, I would like to know if it is possible to match the value of an input.date_time with the time of sunset. For example today the sun sets at 9:00 pm and at that time I want to do the last irrigation of the day, next week the sun sets at 9:10 p.m. and I need change the input.date_time value automatically to do the last irrigation at that time. someone could help me with that.
Greetings and thank you

Lots of great ideas in here. I’ve just finally started down the road of a DIY irrigation system for my back yard. I’ve just worked out how to wire up an ESP32, 4 channel relay, solenoids, and a 12v power supply. I’ve never done anything like this before.

Anyway, just starting to get it up and running on my desk, but I’ll need an outdoor enclosure. What are people using (especially interested in what Aussies are using)? 90% chance of where I end up putting it will be exposed to the weather.

I bought a cheap weather proof enclosure from AliExpress. It’s pretty good. I bought a thin galv sheet and cut out a back panel to mount everything o and then mounted that into the box. I have been meaning to knock up a post about the hardware install but haven’t had time. I may have a couple of photos on my phone I can upload later

Thanks for that @sparkydave. That box (or one similar) is something I’ve been looking at.

I wouldn’t mind seeing some photos of your setup when you get a chance.

Hi There @klogg This is an cool project, thanks for sharing this with everyone. I’ve been struggling with some errors when I copied over the packages, which are as follows:

Package garden_irrigation setup failed. Component input_boolean has duplicate key 'name'
Package garden_irrigation setup failed. Component input_text has duplicate key 'name'
Package garden_irrigation setup failed. Component input_select has duplicate key 'name'
Package garden_irrigation setup failed. Component input_datetime has duplicate key 'has_date'
Package garden_irrigation setup failed. Component input_number has duplicate key 'name'
Package garden_irrigation setup failed. Component timer has duplicate key 'name'

I am running the latest version of Hassio 0.97.2. If someone is able to explain these errors, that would be amazing.

I only have one single zone for my irrigation system, so I’m assuming that I can remove the additional zones from the files and it should still be able to control single sonoff, which I have connected to a irrigation pump? I’ve also just been looking at your code and realise that you have a weather station, is that correct? So if I don’t have the weather station is it still possible to use the packages?

@mattpitts74 I suggest you go and look here My Garden Irrigation
I created a thread for my project and it has changed a bit since I posted those files.

Hey everyone,
I just stumbled across this thread because I’m planing to build an own irrigation system.
Does anyone has used the Sonoff 4CH Pro r2 for this use case? Im planing to use 3 of them cause i have hunter valves working with 24ac and a water pump which needs 220dc, don’t know if im right here, but it should be possible to use them both at the sonoff 4ch pro r2 because this one has potential free switches – anyone experience with that? or can i only use one kind of voltage/current for the sonoff 4ch pro r2?
further more i also have this rain sensor from hunter laying around and was planing to integrate that one, but in contrary to the sonoff basic i don’t know a way to connect this sensor directly to the sonoff 4ch pro - anyone done this before or do u all used a nodemcu/esp8266?

greeting to all irrigationists out there=))

Yes. This does work.

1 Like

Hi Flipso,
Yes Sonoff 4CH R2 will work for you (as iz3man stated above). I use Sonoff POW R2 for my waterpump and ESP32 for the valves.

  • What are the technical details of your hunter rain sensor?
  • Are you sure that your waterpump needs 220V DC? Could it be 220V AC?
1 Like

thanks for the fast replies first of all!!

Perhaps its really AC, messed this up a bit - but it has higher demands on Current then this little Hunter Valves und i was afraid to put high and low demanding devices on one line. the rain sensor is the Hunter Mini Click (https://www.amazon.de/Hunter-Mini-Clik-Regensensor/dp/B01BVVLTY2/ref=asc_df_B01BVVLTY2/?tag=googshopde-21&linkCode=df0&hvadid=344467603589&hvpos=1o4&hvnetw=g&hvrand=2228685127176045679&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9042006&hvtargid=pla-748418096543&psc=1&th=1&psc=1&tag=&ref=&adgrpid=77801524988&hvpone=&hvptwo=&hvadid=344467603589&hvpos=1o4&hvnetw=g&hvrand=2228685127176045679&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9042006&hvtargid=pla-748418096543) , but as stated above it only has this on/off spongmaterial in it - so im not really sure if i want to buy an extra device to connect this thing up :smiley:

Okay, the Hunter Mini Click is just a little switch. This switch gets activated (closed) by rain sooking the spongmaterial and will be de-activated (open) when it is dryed-up.
The voltage/current mentioned in the specification of this device is not of importance because you want to connect one wire to Ground (GND) and the other to a free GPIO input pin of the Sonoff device (supposing that one GPIO input port is available on the Sonoff 4CH device. (I don’t own such a devide).
You can define this sensor (input port) in ESPHome software or Tasmota software to be used by Home Assistant.

What is the maximum current of your waterpump? You must be sure the relay in the Sonoff 4CH can handle this current.
I have fried my Sonoff basic relay due to the fact that my waterpump draws 14 Amps. Sonoff basic goes up to 10 Amps. Now I have the Sonoff POW R2 with maximum capacity of 16 Amps.

1 Like

Thanks for this answer, i think the sonoff 4ch pro r2 also only goes to 10 Amp i’ll check this and probably must use a pow here too.
have done some googling and found, that such an gpio pin must also exist for the sonoff 4ch pro r2 - also if i have to buy a pow, i think there is definitively something there.

You can use a POW for the pump (16A) and the 4ch pro for the valves.

Hi @sparkydave

I tried your code to the T and whenever i set the runtime it doesn’t seem like the automation actually kick off the script to turn on the Retic Station 1 Valve. Instead of ESPHome code on NodeMCU i’m trying to get the automation to call the script script.retic_program1_run to turn on the switch that uses mqtt as referred to in some of your older posts. https://community.home-assistant.io/t/garden-irrigation/1950/167?u=irishinsanity

Have you had any issues with the automation not kicking off the scripts? I trying to figure out if i should remove the automation: !include automations.yaml from the configuration.yaml file and use all of your code as is including the automations in /config/packages/reticulation.yaml or if your automation bit of the code should be in the automations.yaml file.

I REAALY want to get this going. I’ve spent the good of 2 days trying to work this out.
Going to have another crack at this tomorrow again and can paste some of the code here.

Your will be appreciated.

Hello Philippe, I looked at the config of your github files and some configs seem to be missing. I can’t seem to find the sensor config for input_boolean.cycle2_enable, run_time, manual_run, morning and afternoon cycle status, timer.cycle1_zone_duration etc etc. Is it anyway possible we could have a chat perhaps? I tried using the config from your github page but certain information i can’t seem to find in your .yaml files.

I recently change the entire irrigation flow / automation. So if you want to to have a chat you can contact me on discord.

Hi @phdelodder , can you email me your discord details? My email address is [email protected]. Thank you very much for responding.

@klogg Your work is absolutely amazing. This helped me so much. I got everything working as explained. I was wondering. Is there by ANY chance a way you could give advice how to remove the “Daily” and “Alternate” for that for days of the week? I’ve been staring at this code for two days straight and for the love of me i can’t work out how to switch the pieces with some code from Dave. Any help will be appreciated.

  • platform: template # determine if today is selected as a watering day for program 1
    sensors:
    retic_program1_watering_day:
    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:
      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_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

Thanks for the compliment…

Firstly, because I had a few people interested in this I created a separate thread to split my project away from here. You might like to look there as there have been a few changes based on input and help from others.

Regarding your specific question, if I understand correctly it would not be possible as I have only allowed for two different cycles. One or both cycles will run on the days chosen which as it stands is every day or alternate days.

If you want different cycles on different days I suggest you try using the code by @sparkydave which others here seem have used to very good effect and looks pretty good to me (of course I looked at it to see if I could steal any ideas learn from it :wink: )

It works fine for me. I’m not using MQTT (as per early posts) because I’m using the ESPhome native API for HA. Using my most recent code posting above should work fine once you change any relevant entity_id’s for your own.

You can have:

automation: !include automations.yaml

as well as the package. Just make sure you are also referencing packages as per the docs.