x728-UPS This is my code for x728 hat. If power loss, it send e-mail alert. If voltage drop under 3.50v, it will safe shutdown pi.