USB-C powered Water Leak Detector
I already had a battery-powered ZigBee Water Leak Detector in my utility room, but for redundancy I wanted to add a grid-powered detector (one is none and two is one).
Certain ESP32 variants include capacitive touch GPIOs. You can take advantage of this capability to create a Water Leak Detector running ESPHome firmware.
For this use case I went with the M5StickC PLUS2, an ESP32-PICO-V3-02 module in a nice case with a screen and buzzer. It’s only $20 and has a Grove port that can be used for connecting a water leak cable/rope.
On the M5StickC’s Grove port pin 1 is GPIO33 and pin 4 is GND. Simply solder wire 1 on a Grove cable to one of the two wires on a water leak cable and wire 4 (black) to the other one.
Someone already created an ESPHome yaml file for the M5StickC PLUS2 that you can use as a starting point. You’ll need to add the config below. The appropriate threshold value will depend on the specific type of water leak cable you buy. By uncommenting the setup_mode line you’ll be able to observe values in the log as you drip water drops on the cable.
You can use this Home Assistant blueprint to automate an action upon a water leak event (such as turning off the water supply).
binary_sensor:
- platform: esp32_touch
name: "Moisture Sensor"
device_class: moisture
id: leak
pin: GPIO33
threshold: 16
esp32_touch:
#setup_mode: true
iir_filter: 10ms