There are devices that can be controlled by HA that turn water off and on.
Don’t limit your search to shower and look for water. Maybe just put one on the hot water line to freeze them out
Or get two and cut both off.
Possible option. Device is not HA aware. But controlled by HA outlets:
Best water shut-off valve for HA integration? - Hardware - Home Assistant Community