Detecting power outages

As a follow-up I have parts on order to be able to make a device out of a door/window contact sensor that will be able to instantly tell me when a power outage occurs. The idea came from the following post:

This solution wouldn’t be limited to Zigbee, however it does require that whatever connectivity that is required for the door/window sensor be active/online during a power outage. Since my RPi is connected to a UPS my Zigbee network will remain online so this will work perfectly. If you were to have only WiFi and your WiFi didn’t stay online during a power outage then this would be a problem.