Detecting a clogged sewage line

Two days ago, during the night, there was a clogging in our sewage system. The washing machine was running, someone was showering, and the toilet in the cellar overflowed, which resulted in untold destruction in multiple rooms. I don’t want to deal with this ever, again, and I mean, ever.

What kind of detectors could / should I install to be notified of this situation ASAP, in order to avoid any further usage of the sewage system in this situation? Shelly flood besides the toilet? Or even better, can I install something inside the sewage pipe?

Thank you for your ideas.

Flood sensors by any toilet, sink, washing machine, or basically anything with water pipes. Those will also save you any time you’ve got a leak or other blockage.

Potentially a float sensor or level sensor in the sewage pipe, hooked up to an ESP using ESPHome or Tasmota.

Depending how your water comes into house from City, add a ball valve controller to shut off the water instead of relying on you to react. I use the Dome Z-Wave model.

OK, so I plan to use Shelly Flood for flood sensors.

Can someone recommend some good float sensors or level sensors, that could go into the sewage pipe? Thanks.