Or just get a good large UPS with USB notification.
As an FYI, this thread finally forced me to break down and do just that. I have a new Eaton 1500 VA UPS inbound as I type this, for use in keeping my network gear, AV, home automation, IoT, and PWS stuff running...with graceful shutdowns.
Last week, I picked up four Z-Wave smart power strips with individual outlet remote switching and power use monitoring for $20 each, along with a dozen short 1-foot extension cords for spacing out wall-wart transformers on the power strips. I blame that purchase on two months of cabin fever from the COVID-geddon lockdown, which made me notice the power cord and transformer spaghetti knot that grew in my network/AV closet over 15 years.....