Connecting a Raspberry Pi to a 220V switch
You can use an opto-isolator to convert your 220V to a 3.3V logic system. You can use this circuit for the same:



When you turn on the switch, the optocoupler will get some of the current from it (1-2 mA). This will turn on the transistor and you will detect a HIGH logic with your raspberry pi. Also, your ac input will be sinusoidal so the DC side output will be sinusoidal as well. To take care of this, a capacitor has been used which will ensure a continuous HIGH logic till the ac switch is turned ON. 

Once you turn the ac switch OFF, the capacitor will discharge through the 390K resistor and you will get a logic LOW. There will be a delay of approx 100-200 milliseconds though, between switch getting turned OFF and your raspberry Pi detecting LOW because capacitor will take a while to discharge.

Besides being low cost, this circuit also gives you the added benefit of optical isolation. Even if something goes wrong on ac side, your raspberry pi is safe.