You can get moisture detector for some smart home systems&#x2F;alarms, that is installed under laundry&#x2F;dishwasher.
Also that is why all houses at least here have to have faucet&#x2F;valve for laundry&#x2F;dishwashers, and that is supposed to be kept closed when the machine is not in use. My faucet in kitchen for dishwasher actually has a simple electronic valve, that automagically closes the valve after several hours.