This program uses the PZEM004T dogital multimeter with TTY output to monitor a power source, like an off-grid solar panel, and transfer between it and another, presumably stable power source, like the mains.
It uses a 4-port relay, where it turns on the first two relays when the measured voltage on the first power source is above a threshold (buffered over time), or the second two relays when it's lower. The switching is done intelligently, by disconnecting the currently enabled pair before enabling the other.
It is indended to be used with a UPS or a similar battery-powered device.