Power source event trigger Late 2014 Mac mini running Sierra connected to an APC BackUPS Pro 900. No special software has been installed to support the UPS. 

At the moment I run pmset every minute to determine the power source, and trigger actions based on the results. 

However, a dialog window pops up as soon as the Mac switches to backup power. I'm wondering if there is any way I can trigger based on anything else, given that macOS seems to be able to do so.
Yes, using third party tools, like Power Manager, you can trigger scripts based on your UPS state.



Thirty party tools can monitor the UPS state through the IOKit and receive callbacks on state changes; thus avoiding polling.

If you are comfortable with shell script or AppleScript, Power Manager provides hooks for scripting your UPS in these languages.

I wrote Power Manager, so feel free to ask technical questions.