This is a private project that automates watering in my garden. Several ESP32 boards running ESPHome firmware measure, decide and switch on their own, and all of them report to Home Assistant, which shows me the state and lets me override it from the phone.
There are five boards:
- a rain-barrel monitor: water level from a float switch and two capacitive probes, and a pump;
- a greenhouse soil-moisture and temperature monitor;
- a sprinkler controller with a pump and four sections;
- two 4-channel switch boards, one of them also measuring temperature.
The boards are configured separately, but the shared parts (Wi-Fi, OTA updates, web server, logging, and diagnostics such as signal strength and uptime) are ESPHome packages that all of them include. Passwords stay in per-board secret files outside git.
Details#
The sprinkler board uses ESPHome’s sprinkler controller. Each section runs for 15 minutes. The pump starts 5 seconds after its valve opens and stops 3 seconds before the valve closes, and neighbouring sections overlap by 5 seconds.
Template sensors make the barrel levels agree with one another: if water reaches a higher sensor, every lower level reads as wet too, whatever a noisy probe says. The analog probes also use hysteresis.
To calibrate the soil sensors I measured 20 capacitive moisture sensors, dry and in water, and derived a linear formula from the raw ADC value to a moisture percentage.
To build and flash the boards I wrote a small script, board.py (run with uv). It lists the boards and serial ports, compiles, uploads over USB or over the network and shows logs, for one board or all of them, on Windows and macOS.
Schedules and rain#
Home Assistant runs the timetable. According to my notes, the watering controller starts the greenhouse at 8:50 and again at 18:50 and two garden sections at 9:05 and 9:15 every day, and every run switches itself off after four or five minutes. Those times cover three of the sections, not all four, and the schedule sits idle in winter.
Everything else here is planned, none of it built yet. I specified a morning automation that waters only when the soil is dry and no rain is forecast, and the TV dashboard would show the plan and let me skip a day. The same dashboard is meant to start a single zone by hand from the remote, with Home Assistant stopping it automatically.