Build a water-leak alert
ActivitiesProjects
Pair a leak sensor with a notification rule and trigger it with a controlled wet test.
A working water-leak alert links a moisture sensor in a trouble spot—under a sink, behind a dishwasher, near a washing machine, or in a basement—to a device notification. You can tackle the project in two main ways depending on how much hardware work you want: configure a moisture sensor already available to Home Assistant through its documented visual automation without YAML, or wire a dedicated probe to a microcontroller yourself.
Two ways to build the detector
One route uses Home Assistant's documented visual automation. You add a moisture trigger targeting an individual sensor already available to the system—or a broader group such as an area, floor, device, or label—and attach a notification action for the device you want alerted. If you also have a separately configured smart water-main valve, the same trigger can close the valve automatically, though a leak sensor on its own only handles detection.
If you want to build the hardware from parts, an ESPHome project pairs an M5StickC ESP32 with a Guardian Remote Sensor Probe (which comes with a six-foot cord), a Grove connector pigtail, a 3.5 mm female jack, and continuous 24/7 USB-C power—a constraint worth planning for when choosing where the board will sit. One probe terminal wires to Grove ground (GND) and the other to pin G33 through the jack; the two probe terminals have no polarity, and the jack's two middle rings go unused. That wiring belongs to this specific board and probe, which reads water through the ESP32's capacitive touch input and routes alerts through Home Assistant to a notification service such as Pushover.
Calibrating a touch probe before trusting it
A capacitive-touch circuit needs tuning to the exact probe and cable attached to it. After wiring and flashing the ESP32, turn on touch setup mode, dip the probe in water while watching the live logs, and adjust the GPIO33 threshold until the sensor trips reliably in water without false alarms when dry. That calibration step applies to capacitive-touch builds; other sensor types detect moisture differently and follow their own setup procedures.
Tuning alerts so a real leak is hard to miss
Once detection works, the automation rules determine how useful the alert is during an actual leak. When monitoring several sensors at once, you can choose whether the trigger fires for each sensor as it gets wet, only for the first sensor to detect moisture, or only when every targeted sensor is wet. An optional persistence duration—set to zero by default—lets you require moisture to remain present before firing, which changes how quickly the alarm responds.
For repeating alerts rather than a single notification, Home Assistant's Alert integration can resend messages at set intervals alongside a notification integration, tracking the difference between an active leak, an acknowledged one, and a resolved condition. Its documented setup requires `configuration.yaml`, making it more involved than the visual moisture trigger.
With state-trigger automations, some builders caution that bundling multiple sensors into one combined group trigger can stop a second wet sensor from firing a new alert while the first sensor is still wet; listing sensors individually in the trigger is often used to avoid that blind spot. They also note that if a sensor drops offline (unavailable) and reconnects already wet, watching for any transition to wet rather than only from dry to wet may catch a leak that a narrower rule would miss, though exact behavior depends on the integration and trigger type.
Placing the sensor and keeping power dry
Where the sensing surface rests matters as much as the code behind it. Set a corded probe on the floor in an out-of-the-way corner at the lowest point of the room where water will collect first. For an upright board-mounted sensor, as in an Adafruit FunHouse setup, tape the sensor upright so its sensing edge just touches the floor and route the power cable off the ground where standing water could reach it. Follow the placement and power directions for your chosen hardware, and run a live test after installation to confirm the notification or email still arrives from the sensor's final spot.
