brianhanifin / Home-Assistant-Config

Home Assistant configuration files.
https://brianhanifin.com
123 stars 23 forks source link

DIY Local Irrigation Controller #37

Closed brianhanifin closed 4 years ago

brianhanifin commented 4 years ago

Our battery and cloud powered Melnor Raincloud/Aquatimer has been flaky off and on for years. Now even new batteries aren't resolving the problem. Also, there appears to be possible battery acid inside the battery compartment. I suspect the wireless radio may be dead despite being able to manually toggle the valves.

The ESPHome projects I have done around our house have been extremely reliable and useful additions to our smart home. Recently, the ESPHome site featured a user's project that turned a Sonoff 4 channel Pro unit into an irrigation controller, which inspired me. That project features a nifty touch screen display. But I want to start simple. We can start with a dumb relay controller, with the brains being controlled from Home Assistant.

Mk1 Goals

Mk2 Goals

Future Ideas

References:

Parts ordered:

Parts needed:

brianhanifin commented 4 years ago

Today I worked on porting the original code by @bruxy70.

  1. Removed: Nexiton display code. The relays can be triggered for a manual run time from Home Assistant.
  2. Added: time remaining sensors so that we can see when it is running.
  3. Added: status light which turns on after boot, then flashes and changes to full brightness after Home Assistant is connected.

Next steps:

  1. Collect, disassemble and clean disconnected Rainbird box behind the fence.
  2. Figure out how to mount the Sonoff and power supplies in the box.
  3. Figure out how to get power to the box.
brianhanifin commented 4 years ago

Today's progress:

  1. Enclosure: cleaned the circuits and wiring out of the old Rain Bird enclosure, and scrubbed the crud off of the surfaces.
  2. Conduit: purchased supplies.
  3. Drilled a hole through the stucco for the conduit.
  4. Attached a 1/2" junction box connector and dry fit the PVC right angle connector.

Next steps:

  1. Create a riser to mount the Sonoff to. This will bring the controller closer to the front of the enclosure, so it is easier to reach.
  2. Mount the enclosure to the wall.
  3. Connect the conduit.
brianhanifin commented 4 years ago

I took a break from this project for a reason that turns out not to have been a problem. When I hooked everything up initially, triggering one of the valves caused a scary buzzing sound. I assumed I made a mistake with the wiring and didn't want to think about it for a while.

Today I reviewed wiring diagrams on the internet and I decided that I had done everything right. Once I pressurized the pipes with water the buzzing stopped.

My new problem is, I suck at gluing PVC pipe together, because after 2 attempts I still have lots of leaks.

iDXFNIw

brianhanifin commented 4 years ago

Yesterday I stopped the leaks from the faucet to the Zone 3, the pool filler. I am awaiting a few parts from Amazon to hook the drip system back up. I was able to manually start Zone 3 and the pool filled for the default hour, until ESPHome code stopped it. Just as designed.

Today I started on adding the user interface to Home Assistant to set the run time(s) and run duration for each Zone. I added ESPHome code to store those values in sensors as soon as they are changed in Home Assistant.

I decided to use an input_text field to store a comma delimited list of run times (e.g. "09:00,12:00,15:00"). My current challenge is figuring out how to write ESPHome lambda code to parse the list of times, and assign the next run time in a sensor. I need this to run reliably even if it cannot connect to Home Assistant. So, I don't want to do any more than create a user interface in Home Assistant.

brianhanifin commented 4 years ago

Today I reconnected Zone 1, the drip system. I haven't been able to test for leaks yet because the Sonoff is on my desk at the moment.

After some experimentation, I decided to push ahead with having ESPHome handle the scheduling. I was able to learn enough c++ code to extract the next scheduled time from the list of times. That function is stored in a separate file: irrigation.h.

I have found a way for ESPHome to execute a command once an hour on the hour. So, that will be perfect for handling the scheduling. But, that will have to wait until tomorrow. That's enough progress for one day. :)

P.S. Here is the UI. I will add some polish later, but it works great! image

brianhanifin commented 4 years ago

Whew, there has been about 1000% more c++ programming than I had planned on. The scheduler is feature complete. Looking back at my initial goals for this project I have completed everything I set out to do! I created a UI in Home Assistant to allow me to manage the daily schedule and set the duration of each watering cycle.

Notes:

brianhanifin commented 4 years ago

I hooked it back up and my timing was amazing. No sooner had I connected the wires than the pool filler cycle started... because the time was 11:00am. I didn't plan that, but it was a nice confirmation that it is working outside of my "lab".