This sensor with two transistors triggers a relay according to the supply voltage. The power source must be isolated from the power grid.