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 3-zone sprinkler controller;
- 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#
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.