I want my Raspberry Pi to know when I've turned on my light switch. My rpi is always running anyway for another purpose, and in the same room I've got wifi-controlled smart bulbs and a light switch controlling a completely unused outlet near my rpi. I would like my raspberry pi to see when I've turned on/off the light switch, and appropriately send the signal to my light bulbs to turn on/off.
I'm thinking of using an old usb wall charger and a usb cable, connecting the usb cable to a 5v relay from Sainsmart and using that to signal to my pi that the light switch is turned on. Would this work (safely), and if so, how would I connect that to one of the Pi's gpio pins?