Robin2:
What about an infra-red break-beam sensor - just an IR LED on one side and a photo-transistor on the other side....R
I second this. very easy and very cheap. One down side might be, if the lamp is in direct sunlight the IR sensor might become saturated and falsely trigger the switch. Maybe this can be figured out in code.