Switching between 2 power supplies without outage
The normal method is to use two diodes to combine the power supplies but that only works if 1) at least one supply is on all the time and 2) the preferred supply is higher voltage.

If you have two sources at the same voltage and you want to completely shut backup power off when the solar is available then things get a little more tricky.

You can a relay to shut off the backup power, wire it so that the coil is energized by the solar supply and the backup supply is on when the relay is powered down. The issue is that when solar fails you'll get a brownout while the main supply comes up.

Either you need to know that the solar supply is going to die just before it does (either the voltage dips below a threshold or some other warning signal) or you need a 3rd short term power source to keep things running, either a battery or very large capacitor.

Assuming your system can manage with a lower voltage supply this can then be diode or'ed in with the other supplies. Since it'll only be used for ~1/2 a second when failing over from solar to line power it doesn't have to be very large.

e.g. 






simulate this circuit &ndash; Schematic created using CircuitLab