I'm expecting a smart plug with energy monitoring somewhere in the mix is what you are after, just where it needs to sit others than hopefully comment on...
I'd suggest a ring alarm range extender plugged in somewhere other than the UPS. This little gizmo makes a great zwave repeater AND reports power source. It would be simple to shut down the hub with RM and a trigger based on this device.
Powering UP the hub again when power was restored might be a little trickier, though I bet if the UPS loses power completely and then power is restored HE would start up again. The issue would be if the Ring detected a loss of mains power and shut down the hub but power was restored BEFORE the UPS died, so the hub never was "unplugged" from power, so to speak.
If you have a raspberry pi that is always running you can run NUT server on it and that will listen to signals from the UPS. Then install the NUT driver on the Hubitat and have it listen to the NUT server and shutdown. That is how I did it with A Cyberpower UPS at my Mom's house. I use NUT at home also but it's running the server on a Synology NAS.
UPS ->> USB Cable ->> Raspberry Pi with NUT ->> network ->> Hubitat with NUT
The problem with this rule is that the hub misses the event for return to mains after the hub shuts down and later reboots. You need to add a refresh on the power source in your systemStart rule.
Never had a problem with the code. All the pending delays are executed and the hub shutdown completes. No need to deal with the trigger back to mains on the hub rebooting, the status of power state on reboot is once NUT starts is "mains". I have testing this at least 10 time and also had 4 power conditions that lasted more that the 5:30 and the hub shut down. A simple reboot of the hub and everything it back to normal.