Without knowing what is being used for a UPS and its communication capabilities, I can only suggest some general basic techniques
- UPS determines power is lost. Generally not much needs to be done here, except perhaps powering down some devices to extend battery backup time.
- UPS gets close to losing battery backup. Gracefully shut down the hub then Remove power from hub.
- UPS reports power restored. Restore power to hub causing a reboot. Perhaps delay for a few minutes.
Here's a link to my solution using an APC UPS with Windows 10 and a WIFI power plug. There are also links to other solutions.