Most DIY type will at one time or another have pondered water sensing - I wasted lots of time with cheap resistive garden sensors a few years go before realising that galvanic current would eventually kill them, then I hit on the capacitive sensors - and even one controlled by Bluetooth - but that's a different story. If you are interested in that - check out this link and this one and this one and... the list goes on. But I digress...
Isn't this PRETTY? Just as I was packing up to leave sunny Spain at the end of the summer, we had a very rare and serious flood in our village over there and I started to think about (more prevalent) floods back in the UK - between that affecting our (raised farmer's field adjacent) rear garden and also my memory when it comes to filling the bath, I wondered if there was a NEAT, cheap and reliable solution for THESE potential issues. Just at that time I was looking on YouTube at Andreas Spiess ("the guy with the Swiss accent" who calls us all "YouTubers") at a sensor he'd been playing with which is suitable for BOTH flood detection AND bath overflow (and most likely MUCH more) while being cheap, optical, waterproof and hopefully reliable.
I wrote off in a rush to Banggood and others in the hope that someone would come up with a sample for me to play with. As it happens the result was overwhelming.
EPT technology sent samples and some info on the FS-IR82B and you know that saying about a picture being worth 1000 words - well, here it is, below. Did you by any chance do refraction at school/University? If so then this should be obvious. If not, LEDs inside the unit bounce light around the surfaces back to simple sensors... all of this works when there is air on 4 sides but water is another matter.
Banggood came back quickly with this - 15mA 5V Optical Infrared Water Liquid Level Sensor.
This sensor is made out of sturdy-looking plastic. in my case with a short (0.5m) lead and 4-way connector. Andreas (above) tells you how to (simply) wire it up. In the case of the bath, easy - push through, using the silicon seal on the front and the plastic nut on the back - come up with an alarm mechanism.... in the case of a thick stone wall not so easy - but I'll find a way. ('m thinking of a plastic tube and silicon sealant right now. I'm sure I'll find a way to get a signal back to Node-Red so my phone can alert me to floods when I'm not at home or stop the bath overflowing when I AM (but blogging when I should be paying attention to the bathwater) - others may pick a much simpler route.
Oh and Ralph S Bacon did a good video about basic use of this sensor.
To refer back to Andreas, according to Steve Lenehan, Andreas is using the low-cost tyre pressure sensor system I recently blogged, to monitor his beer brewing process - how about that for a spot of lateral thinking. I just took a quick look at his video.
So, now we have a solution... what's your problem? Actually the more I think about this, why just water? Any liquid that does not damage the plastic? But again I digress.