Is it possible to code a DPDT switch?

Hi,
IF you have enough power to run the relays with the solar panels...

You might look for a "Double Pole Double Throw LATCHING relay..

Or find a DPDT "microswitch" and have a servo push it on and off. With the right mechanical arrangement (a little 'over center') or a cam, you can only power the servo when you are changing the switch..