First, build yourself a device that detects when power is off, i.e. a Power Monitor.
Then write a rule like this:
Trigger:
Power monitor *changed*
Actions:
IF (Power Monitor open) THEN
Send POST to http://your_hubitat_ip:8080)hub/shutdown --> delayed 1:00:00 (cancelable)
ELSE
Cancel delayed actions
ENDIF
For this to work, you must have disabled hub login. Set the delay to the appropriate length for your battery backup.