Failsafe for home automation with Raspberry Pi
You could use light sensors giving feedback to the rPi about its state. Or use some small value resistors (sense resistors) to tell the rPi if there is current flowing to the lamps. Hall effect sensors on a lead to the lamps could also detect current without the power loss that a sense resistor would incur.  Each of these could determine state.  In software, you could control the relays depending on the desired state versus the detected state. 

The alternative power could be provided by a normally closed relay whos coil is powered from the rPi's power.  If that was lost, the NC relays could introduce power to the lamps from an alternate feed(backup).  When the pi came back online, it would then OPEN the NC relays now letting you KNOW the state of the bulbs is OFF and the rPi would continue on its original program. A single pole switch in line with the backup relay and the bulb would allow you to manually control power.