My Garden Irrigation


#21

@klogg

This just highlights how little I know! I understand everything you are say but could never have come up with it myself!!

You have done a great job. Seeing what others have done is very inspiring.


#22

@klogg you’re an inspiration!
I’ve got a working dual zone system on the bench atm - the package makes things very simple!
I’m using the sonoff 4ch pro r2; it’s the one with isolated relays so i’m able to go direct to the solenoid valve without needing any extra kit. @cjsimmons you asked if it was possible to do this way - my testing indicates yes :slightly_smiling_face:
However, the valves run crazy hot. Like evaporates water hot. My reading indicates this is normal, however does anyone have any experience to suggest otherwise? Not too comfy atm just boxing these things outside knowing how toasty they get after only a few minutes usage…


#23

Good to know. Although your heat issue is a little concerning. Be good to know if it’s the Sonoff causing the issue, or if it’s just the valves.


#25

Anyone tried to integrate your own garden plant with floorplan component or similar? And show sprinklers icon, for example blu and animated, when a zone is running? Is it possible to implement a solution like my idea or no sense?


#26

@klogg
I think there is a typo error in your file garden_irrigation.yaml
Under section “Run A Cycle Manually” you wrote:

if trigger_entity_id

Instead:

if trigger.entity_id


#27

I confirm, I have made the suggested change now works manually that previously did not work, I follow Klogg for a while (which I thank) in his first projects the manual method worked and in the last no, it was just a typing problem. I’m waiting anxiously for my part to rain to test the estimate with the weather forecast.


#28

You’re right!
Thanks for spotting that. I have no idea how that crept in.


EDIT: Now corrected on GitHub, thanks again for spotting it!


#29

I read all code from @klogg to understand how it works before assembly my hw. It’s a very good and self explained code.
The next step i’ll to try implement, when my hw is done, is try to do some checks in ui side, for example block the situation when zone 1 is set to start from 8.00 to 8.30 and try to set another zone at the same time or time overlap the zone 1…for example set zone 2 from 8.10 to 8.40 would be good if a popup alert appear with message: “unable to set zone 2. Start selected is between another running zone time (zone 1)”


#30

Please don’t expect this part to work well, I have made so many changes to it in the past trying to get something sensible and never succeeded. I think the principle I use is sound and the logic should work but the data it collects is not good enough!

Please report back here if an when you get something useful.


#31

I agree. I thought about doing this and then decided not to do it, only because at the time I wrote it I never once considered that this would be used by anyone else!


#32

In every irrigation system controller like rainbird, orbit, hunter,… There is no check about this situation. If settings are not good, simply the system doesn’t work. In your HA version this can be a plus value feature!
I’ve a question. What’s the best way, if possible, to integrate a commercial 2 wires rain sensor to your code?


#33

IMPORTANT - regarding weather calculations.

Not only does my implementation need better data (as I have said) but also the last attempt I made to make this work uses the new(ish) Integration Sensor which I set up in a separate testing part of my config. As I forgot that I had done this it means that it doesn’t exist in the GitHub code at the moment.

To make the code work (in the sense that it will run - not in the sense that it produces useful data) you will need to include these lines somewhere in you config:

sensor:
  - platform: integration
    name: Rainfall today
    source: sensor.dark_sky_precip_intensity
    unit_time: h

It is referenced in garden_weather_data_collection.yaml in the section

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

BUT as I keep saying, you will still not get sensible results :wink: . I actually think this is completely the wrong sensor to be using anyway as I misunderstood how it works!


#34

One question :is there a safety way to stop irrigation on some bad scenarios? For example raspberry send a mqtt command to open valve number 1 for 15 minute, then mqtt to stop valve 1 and start valve 2 for 15 minutes and so on for all 4 valves (if i have 4 valves of course) … But if the router fail/broke after valve 1 is opened, for example after 10minutes…mqtt stop command can’t be never send… Is it true? In this case valve 1 still remain opened “forever”?.. Is there a safety check to stop valves after some times by sonoff directly without wait for HA?


#35

From my experience if the node loses wifi the outputs stay as they were beforehand. ie: valve remains open. It is for reasons like this (or if HA is offline for some reason) that I am currently changing to a system where I have all the automation run locally on the ESP device, using parameters given to it via MQTT variables which are held in memory until updated with new values. This way once the ESP receives the variables it can perform the irrigation tasks without HA intervention if needed. Once I have it fully operational and tested I’ll share it


#36

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??


#37

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:


#38

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


#39

@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


#40

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

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


#41

Also,

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…