There is a class of device that basically monitors the internet and toggles an onboard power outlet (usually to your modem) if the ping fails. The are called ezOutlet by Megatec. I got the single outlet one from amazon and love it. https://www.amazon.com/dp/B0861NX6H2
I didn’t see an integration in HA or HACS and was wondering if I could ask for support for it. It has a local LAN webUI controller as well as a cloud support so I imagine it would be relatively easy to integrate.
I did a little poking around in my browser’s dev tools and found that I could get the device to reset using this curl command:
curl -u admin:'mypassword' --location --request GET 'http://x.x.x.x/overview?reset=Reset'