Pause - Power Failure w/ UPS

I was wondering if it was possible to develop a plugin or functionality that would look for feedback from a UPS device that is plugged into one of the USB ports to see if the UPS is on line power or battery power. If the printer sees that the UPS goes into battery power for more than 1 minute, it could initiate a pause (using the g code from the settings) and then save the print information into a file. Once the unit powers back up, OctoPi could load the print job back in and offer to resume for the user. This is far beyond my skills in this field, but I'm more than willing to work on this with anyone.