Being able to react on time is critical if the power fails. No wonder some battery backup (UPS) is needed, but in many cases it is not enough to just keep the session going, so some actions must be started.
With the Dragonfly’s ability to launch scripts upon sensor events, it is really easy.
Just purchase a simple relay, powered at 5V DC (please note that you can’t use solid-state relays – please use a mechanical one, such as this one). Use a cheap mains adaptor, such as an old mobile phone charger, to power on the relay, but plug it outside the UPS (unprotected!). While there’s power, the contact of the relay will remain closed, but if power fails, it will immediately open.
Now wire the relay, its two switch pins, to any of the Dragonfly’s inputs, and it will detect when the power goes off. As you already know, a script can be launched if one sensor goes off, you can use it to take any appropriate actions.