If you have a zigbee network the aqara leak detector is a good option. It doesn't require a hub, cloud or any setup. And if you are willing to wait you can get them on AliExpress for a lot cheaper than Amazon.
I have a few of the Aqara leak detectors and they have worked well.
They also have screw terminals that you can attach wires onto to extend the detection area/range. I’ve also seen people attach contact or pressure sensors to them, they are nifty devices.
an esp8266 (or esp32 if you have on laying around) and a long wire. cut that in half, remove the insulation from the ends, wire one to ground and one to any output pin on the esp. detect when the pin gets shorted (basically a button activated by water).
use esphome and the button input.
I have a couple of these Zooz Z-Wave water detectors. They were recognized by zwave2js, and easy to set up and test. My only issue is that I get triggers from them whenever the Z-Wave network changes - like, when I add new devices, I get an alarm from them.
They're tiny - like the size of an old box of (matchstick) matches. If they were cheaper, If put one under every sink.
I had a similar issue with other zwave sensors. With a little help I was able to refine my triggers so that my automations only run when they go from an “off” state to an “on” state. Before that they’d trigger from a “none” or “unknown” state, which is what happens when HA or zwave2js restarts.
I bought the Govee leak detectors and paired them with a Tasmota flashed Sonoff RF Bridge 433. They’ve already saved me multiple times from leaks that would’ve gotten out of control without me being notified. The Sonoff Bridge can’t be flashed with Tasmota as readily as before but you can probably find a compatible version somewhere
After a water heater leak I just made my own. I run my HA on a Raspberry Pi, so I connected the GPIO pins to a current-limiting resistor and some wires that I put in the drip pan of my water heater. I made the two contacts using a screw connector, and hot glued it in the pan. You can also do this with an ESP chip. Additionally, I integrated my smoke detectors through an optoisolator and connected all my hard-wired door and window sensors to the GPIO. It's been working great this way for me.
THIRDREALITY Zigbee Water Leak Sensor. I got it off amazon $20 works great with ZB2MQTT I have it under my AC unit in the garage incase the drain gets plugged and condensation goes crazy. It beeps loudly when it detects water so if something is up with your HA or zigbee network, it still alerts someone. I would buy another one, prime shipping and not too expensive.
I've been using a Tuya zigbee one.
The sensor is a plastic block with a mounting screw hole, and two metal contacts on the base.
Water hits the contacts, it transmits an alert.
Sensor is on a wire, attached to the transceiver and battery, so it can be put out of harms way.
Fired straight up in standard ZHA under HomeAssistant.