The most basic thing I could put together to work in conjunction with the code posted as a driver for NUT UPS's to alert you when the status changes. For many of us internet/networking stays up when the power goes out (AKA HE is running, without mains power) so this is a generic application to notify you that the powerSource of a device has changed.
Note: UPS's are not the only devices that have powerSource functionality, so this may be usable with other devices.
This does not care what powerSource you change to/from, it simply reads the source on start up and notifies you EVERY TIME it changes. I have sketch code in there to pop an event when the battery % changes as well. I will probably have it try to gather the alarm and shutoff % and send alerts when they are getting close, etc. Basically keep you informed of when things may shut down.
One thing a few people requested is to hit the endpoint to shut down the HE at a certain %. I haven't put it in here (I don't ever want mine to shut down, generator power should have kicked in by then) but probably will add it for those who are not using the user manager/secure option.
This is just something I wrote as a stand in until they add powerSource as a trigger option in RM and/or HSM at which point this is not needed.
Available Here: https://github.com/chrisuthe/HubitatDevices/blob/master/AlertOnPowerSourceChange.groovy