You could put a Ring Alarm Extender Gen 2 on a mains socket that will lose power when the grid goes down. The Ring Extender will send a “switch to battery” power event (it has internal battery backup) to your hub when power is lost.
My sample rules are here, modify to do what you want on power down.