Hello Luca, and welcome.
The simplest fix will be an (Aqara) water flood sensor.
.
Second, a Shelly Uni can do the job as well. It’s way smaller, but needs external power.
It has two configurable inputs you can use.
https://shelly.digital/product/shelly-uni/