The switch simulates the main power outage, once deactivated the relay quickly switches to the second power source which can be a battery, solar panels or a generator.
Once the main power is back online, the relay switches the load back to its previous state