A simple floating magnet and contactor($3.14) module connected via a two-wire 0.5mm cable to Sonoff DW2-RF (open version only).
In DW2-RF, the contactor is desoldered… soldered wires, each wire in a separate thermoplastic sleeve with glue, the whole in an additional thermoplastic sleeve with glue.
In DW2-RF, a hole is cut for the cable.
The whole thing works on the principle that when the water level drops below a certain point, the sensor is opened and the DW2-RF sends a signal… the rest is based on scenes.
I use this to turn off the water pump so that it does not run dry.