Detect short power glitches to protect heatpump compressor

by Daniel Born: If HestiaPi is connected to an APC UPS and using apcupsd to monitor it, detect short power glitches or brownouts and temporarily switch from heatpump heat to aux heat if currently running (for safety reasons, don't just turn it off) and turn off heatpump cooling also if currently running for 15 minutes or so and then revert back to previous settings.

I've actually had this happen at my house and my heatpump compressor locked out and tripped the internal protection. I had to manually reset the compressor protection inside the unit. Most people would have called an HVAC technician to come fix this and pay $$.