No, I don't want to measure the mains voltage (yet) here.
I want to build my garage lamp switch as minimally invasive to our current setup, as I can.
What does that mean?
The lamp today is switched by two wall switches (one inside the garage, one in the house at the garage door) in alternating configuration. I want to keep the possibility to operate the lamp with this switches. As I'm not an electrician, I not really want to touch the wires, switches inside the wall (it would be a dirty job anyways). Fortunately I've continuous mains source also at the lamp itself.
So the plan is to connect the remote switching unit to the uninterrupted source and sense if the switches are on or off. This signal will be used to alternate the lamp and not to determine the status. Every time it change (from on to off or off to on), will change the light state.
For the sensing I need some electronics. The mains is not a child play so the proper isolation is crucial.
I want to stick to the simplest circuit possible:
A capacitive non-isolated power supply (two caps, two resistors, a diode and a zener) plus an optoisolator. The whole thing cost around $1.
Here is the design: