Well this looks like a go ahead. I’ve just about completed a prototype garage multi device (temp, humidity, lux, 5v relay for garage door toggling, 2 x reed sensors to detect the open/close/ajar states) and to be honest it went better+easier than I expected. It’s all done with comms over wifi and using MQTT for commands.
The hardware for the garden irrigation will be even simpler than this. The activation side of the code will also be fairly simple. It’s the decision based code I think that might get complex…
But I’m encouraged now - I know I can get it done! Stay tuned!
I’m very interested as I’m planning on undertaking a similar project this year. I too have been debating whether to go down the OpenSprinkler project route and have the smarts in the controller vs having the smarts in Home Assistant and/or Node-Red and using MQTT go communicate with a relatively dumb controller.
I’m leaning slightly towards the OpenSprinkler project route to benefit from the knowledge and experimentation of those that have been playing with the scheduling logic for far longer than I. However, I reserve the right to change my mind - particularly depending on how your investigations go.
Well - I’ve racked up some experience on a few things and do feel a lot more comfortable with HASS, Arduino and MQTT. I can’t see any blockers at this stage that don’t begin with a dollar sign.
I have an 8 channel relay board that have hooked to an ESP8266:
Each channel is connected in a “normally open” state - so that on a power off state at the controller all relays will be off - it won’t irrigate if the power fails
The ESP boots, connects to wifi and subscribes to an ‘irrigation’ topic on the MQTT server
The message sent to the topic has the region name of the garden area to irrigate and the total time to irrigate (in minutes). The irrigate time/length means the ESP will count down and switch off of it’s own accord in the event that the ESP can’t communicate with MQTT for an “stop” type message
Upon a successful irrigation the ESP sends a “success” with a “total time watered” back to MQTT
Will halt all on a “stop” message via MQTT
The hard bit is now learning the automation part and being able to express it in YAML:
It needs to have a tab with a group of garden region irrigation states/override buttons
It needs to automate scheduled watering (no UI for this, just scripts)
It needs to irrigate based on triggers (weather is over 38c, bushfire alert within home zone)
Needs to show the success/fail state of irrigation attempts
But that’s it. It needs a nice water tight project case, and I could put in a impulse based flow meter at the tap end of the irrigation. It would give me:
Alerts of water flow outside of a trigger, schedule or manual switching (leak alert)
Litres used total[today|this month|etc] / litres used per zone
Litres based irrigation*
This last* one would combine with my pool water height sensor. When the “pool level too low” state trips, I could ‘dose’ the pool with a couple of hundred litres to top up.
WAIT A MINUTE - lol. I just reread my opening thread. I basically repeated myself. I will leave this here as vindication of my current thought process!
I also have my garage door hooked up via a 5v relay and a reed switch to detect state, controlled via MQTT. I have connected my three aircon units via ESP with infrared LEDs, with an additional RF output to control some power outlets - you guessed it, all via MQTT. I have also started integrating the TTS abilities. All in all, HASS is just bloody amazing. Everything works flawlessly.
Initially I had considered going the OpenSprinkler route, but at the end I decided to save the money or effort and go my tried and tested route. So what I’ve used:
1 x Wemos D1 Mini - to drive relays and sensors
1 x Wemos D1 Mini + OLED to show zones states. This one is yet to be implemented, but I’m nearly there. The way I have set it up means that it’s an independent piece that plugs in my PCB once it is ready. It has no effect on the main function.
4 x Wemos relay shields
5 x momentary push buttons. Four of which are a manual override for the watering of my four zones. The last is a “all zones off” soft kill switch. If things were going pear-shaped there is a 240V mains switch as well.
4 x LEDs to show state of play on my 4 zones. I decided for this addition, as my OLED display code was slow coming and in my opinion is is quicker and more obvious to see the state on LEDs than on a small little 1" display.
a few other bits like PCB development boards and connectors.
and … hass, obviously.
The main wemos (ESP8266 board) control board is running the brilliant arendst/TASMOTA firmware and communicates with the Home Assistant via MQTT.
The firmware sports options for driving relays, as well as switches that are internally coupled with the relay controls. This means that you can equip your design with hardware over-ride buttons, eliminating the sole dependency on HA to be the ring master. In my designs I always like to introduce manual redundancy control mechanisms, just in case the WiFi is down, the Home Assistant goes down or is experiencing issues, etc.
The only stumbling block was a flexible enough system for automating the sprinklers. I had considered using a 3rd party solution, such as OpenSpinkler or custom development app Blynk. After much deliberation I scrapped those plans and instead decided to keep all control to HA. That means there is one app to control everything, it minimises and communication issues between systems and reduces complexity for users, aka my wife.
Creating a scheduling system is not HA’s strength though, certainly not on par with OpenSprinkler. But it is possible to have something pretty near good.
I have built upon the solution detailed in this community forum “Creating a[sic] alarm clock”. Basically, hardcoding four Zones with control i.e. enhanced “an alarm clock” for each of them. Currently I have UI elements allowing the user to set time and duration of watering upon the condition there is no rain predicted (WUnderground). This is executed everyday according to the schedule. I will further enhance the logic with a slider dictating repeating pattern from hours to days. Whilst not perfect this should cover most automatic situations. If there is any other situation when the user wants the sprinklers to come on there is the HA manual control via the standard interface, manual buttons on the control box and voice activation via Google Home + IFTTT.
If there is any interest I can show the code and hardware solution.
An irrigation supply shop. (NZ based). But Amazon does them too. About NZ$35/piece, which is a steal.
They are the non-latching type. Again, if things go sour, they’ll close when power is cut, thus not flooding the garden.
Being 24VAC, it’s a bit of a pain. The OpenSprinkler system/board can control them from 5VDC due to some clever electronics design. In my case, I just used a step-down transformer.
I think I’m gonna go even a bit smaller scale, there are similiar way smaller normally closed valves selling on ebay for 3usd. Also dunno if I should go with a dedicated software - https://github.com/Dan-in-CA/SIP
In any case I’d be interested in all your code and yaml for this stuff :). Very nice! So you think that Sonoff 4CH Pro, would be a nice controller once Tasmota fw supports it ?
I have finally got everything in hass to work as desired. Configuring the automation was “baptism by fire”, due to some undocumented quirks… Let’s say don’t use now() function as a trigger in automation… more on it in “Having Trouble with Template Trigger”.
For now as a teaser, I’ post a couple of pics from my “Garden Irrigation Dashboard” and when I get chance, I’ll post the code too. Hopefully, tonight.
@marksev1 there was something about those smaller valves that my irrigation shop told me that made me pass on them… if I could just remember…hmmm At any rate the obvious considerations are water pressure, driving voltage, size, connection to your pipes…etc.
That Sonoff product looks very nice. Had I found that earlier, I’d probably not had bothered with my project
Petr why is it turning the system on and off so much times during the day, based on the red lines in the history thing? Wouldnt that fatigue the system, shouldn’t the grass need irrigation less times a day.
That’s just me testing the automation rules, as I pointed out, there is a quirk that took me a while to crack.
Also, that history is not really the irrigation switching on/off, but me pressing the “Reset Next Run Timer” button. This also shows a bit of a limitation of HA and an unusual phenomenon, I’ll call “ghosting”. Which ever element is listed last in the group, will be reflected at the top of this modal window. Including the state of the element. So if it’s a switch, as in my case, it keeps showing on/off state. In the upper screen in the view “Sprinklers Zone 1” > Settings, you can also see the state of the switch. It would be nice to be able to specify your own text, but I can live with that.
Ideally, the whole sprinkler Zone should be an “installable” component. The whole premise is fairly simple, flexible and universal, provided your controller supports MQTT.
I might order myself the Sonoff 4CH PRO, just for fun and once it’s flashed with TASMOTA it should work without any further tweaks. Thinking about it, it’s pretty much exactly the same thing I built. Hand on my heart, I had not known about the Sonoff 4CH PRO.
Hi. Just FYI - latest model of Sonoff might have some “improvements” that require additional steps when flashing. I’ve just received Sonoff Dual. It has one more microchip onboard. That’s why regular procedure does not work. Possible solution explained in this video https://youtu.be/8naMP_OpBuY?t=3m25s. Keep it in mind when taking final decision.