dave-in-nj:
as a rule, we do not offer help to those wanting to get involved with mains power. the help and advise can results in injury, death or lawsuits.that being said, if your lighting circuit is connected to a wall receptacle or any sort of plug in. the lights in my bathroom have a place to plug in a shaver or tooth brush. it is turned on and off with the light switch so I do not have to touch or alter any mains wires.
one can plug in a cell phone charger to the receptacle. when the lights are off, there is no power and the phone charger has no output. when the lights are on, the phone charger has power and a 5 volt signal is present. Bob's your Uncle !
In doing this, you only plug in a device that is already made to be plugged in to the receptacle and you never have to touch the mains wiring.
in my old house there was a light switch for the attic light and in the attic, there was a light with receptacle, see other options on the above link.
Also, as a logic exercise, regardless of the switch position, and regardless of power being present, there is no guarantee that with power present, that there is light.
the LDR is a very cheap sensor, is all low voltage, and is isolated from the mains power so there is no risk of compromising the wiring of the house.
One thing that home-owners and hobbyist never consider is that at some future time, an actual licensed electrician may be called to do work, see some problem, created by the homeowner, and try to return it back to the way it 'should be' only to put mains voltage on wires that are connected to some unknown device that catches fire and burns the house down.
as a rule of thumb, if you have to ask about touching mains wiring, we suggest you talk to a local, licensed electrician. for the money they will charge, you will be assured it is done properly and to local codes.
thank you for replying.
I'm pretty sure you haven't understood what I'm trying to do.
Iam not an electrician but I know some things.
What I am trying to do need the cables that are in the wall switch. I CAN NOT finish the project with out them.
If I call an electrician first of all he is not going to do what I need him to do. Also I'm gonna miss the magic of creating something by my own. I like electronics and I'm currently studying it.