I believe what you want is a motion sensor to control a light that is connected to a switch. I'm not clear if you also want to have the light only turn on between dusk and dawn. The Smart Lights (SL) code is designed to work with a setup including a motion sensor, a light, and optionally some kind of luminescence sensor.
I wrote the Advanced Smart Lights (ASL) code to extend the capabilities of the SL code Gene provided. ASL can use a motion sensor, a light, a switch capable of transmitting, and a chime. I do not have any kind of light sensor, so I utilized APPs available within HG to determine day/night. I also had an issue with false triggers due to wind, bugs, birds, etc causing my chime to trip repetitively, so I included a nuisance timeout. The switch can be used to override the motion sensor or turn the light on for a timed period.
In either case, the modules you are using should work without significant modification. I use X10, so I know ASL will work with that. I don't use other systems, so it's possible that some slight modification in the way modules are referenced or what values to check may need to be applied. The ASL code is fairly well documented IMO, so you should be able to follow along so long as you can follow the logic/read pseudocode. If you find bugs in ASL or have improvements to suggest, let me know and I can try to help out or update the code that's in the contribution thread.