My Garden Irrigation

Or maybe a solution like this? :

  1. Add an ESP with a relay that control poweron/off of the MAIN valve with an internal countdown

  2. when HA execute the script to open valve n1 for 30 minutes (example) , the script also set the ESP to poweron to ensure main valve is open. And ESP start with an internal countdown from 35 minutes (30minutes for irrigation set before and 5minutes - for example - for safetly purpose)…then HA close the valve n1 and open another valve n2. The script to open the new valve n2 reset the ESP countdown to 35mins again…in the case HA stop working at this point, ESP countdown until get to 0…if this appened, the system is in “fault mode” so ESP can poweroff master valve!

I think it can be a good solution to stay on HA… adding only an independent hardware to control the power of main valve with a internal countdown that reset on every mqtt command from HA. If the mqtt command to close a valve is not sent before countdown go to 0, ESP can poweroff the system by it self

So @klogg code, can be only update with an input_boolean named for example ENABLE_SAFETY_ESP_POWEROFF_IRRIGATION… If true, every script that open the valve set the countdown ,passing the duration of the irrigation + some minutes (like 5). If false, set internal variable of the ESP to disable doing his job!

This is my idea to use an ESP with sonoff 4ch and HA… But i don’t know if ESP is necessary or we. An set a internal countdown inside sonoff 4ch??

1 Like

As you can see in my garden_valves_failsafe.yaml I was a little concerned with errors causing the irrigation to never stop! I think I have accounted for any coding errors but external faults are not something I have looked at… :scream:

Yes i’ve seen your code to prevent failures using coding :wink:

I’ll do some reasearch about sonoff if it possible to set the internal countdown/timer via mqtt… If it possible i think check by hardware can be implemented without too much editing… I hope

@klogg ok I think I found a solution using sonoff with tasmota firmware.
The command to use is PULSETIME1 where 1 is the relay in case of multiples relay.

every time a valve is open, we need to send this command also:

cmnd/sonoff/PULSETIME1 2100

(2100 = 35 minutes)

When we need to close a valve we can disable pulsetime in that relay:

cmnd/sonoff/PULSETIME1 off

And enable it on the next valve to open

cmnd/sonoff/PULSETIME2 2100

In this way we have am hardware controller in case a valve is open than 35minutes in case wifi fails to close it


Nice… This looks promising. And should be easy to include in the code.

I’ll look into it over the next few days…


this SmartWeather - Get local weather data combined with Dark Sky Forecast looks like a promising source of rainfall data if there is a weather station near you.

I’ll be looking into whether it will fit into my system over the next few days/weeks…

Thank you. I’ll take a look at the service. I hope it is good for Italy weather

What do you think about implementing Programs like real system irrigation controller?
For example most of it have Program A, B, C.
Each Program has it’s own start time and duration.
It is usefull for system where a valve watering a garden, and another valve is for microirrigation/drop irrigation: valve for garden probably need minor time and can run every 2 days… Microirrigation can be longer and must run every day, and more times in a day (morning, afternoon and evening)

My new (yet to be fully tested and released) irrigation controller has 3 programs to give the functionality you are talking about there. I hope to have it ready very soon and post it here

1 Like

I’m very curious to see it :slight_smile:

@sparkydave I’m keen to see this too. My NodeMCU turned up this week. I’m yet to do anything with it, but very curious to see your project.

I’m just trying to resolve a couple of syntax errors in the ESP automation which have gotten the better of me and then I think it will be ready… at least I hope so because I want to put it into service in a week

1 Like

This is where I’m currently at… one little hurdle and then the project should work. I just need help comparing some time values.

I’ve finally decided to think about this and actually it should be very easy.

PULSETIMEx can be permanently ON and set to whatever the current zone run time is (plus a little bit). There is no need to ever set it back to OFF. There is already an automation that does stuff whenever the zone runtime changes so it can be put in there.

I’ll look into adding this in in the next few days and I’ll copy it to GitHub.
(As well as the changes I have made to the weather calculations which appear to work quite well).

Very nice! I’m going to finish to wire my sonoff and valves tomorrow and try to irrigate with HA instead the old commercial irrigation controller! At the end do you use new smartweather service for calculation?

Yes I do and it seems to work well.

Ok i’ll try it. My location in Italy is a little far from first available station so i need to try in this way if it is sufficently good for me

Yes, I got lucky. There are only three that you could even consider to be in my area but one of those is less than 5 miles away.

Hi, congratulations for your work, I was very impressed with the structure of your irrigation system.
I’m trying to implement it in my Home assistant configuration, but it doesn’t seem to work, the automations get stuck in the moment that script.irrigation_run_a_cycle must be launched.
Are you sure you don’t miss something in the packages that is present in your configuration?

@daxda There might be one or two very small errors that have crept into the config as I hadn’t touched it for several versions of HA before I put it on GitHub and there have been breaking changes.

I have a working copy on my local machine which I have been testing as summer is coming here and all is working properly so far.

I will upload a complete copy of the package to GitHub again but I’m afraid it probably will not be today. Hopefully tomorrow…

1 Like