A simple timer relay activated by whatever detection system you prefer (light beam, body, touch etc).
Both items can be bought off-the-shelf but consider using a simple motion detector as per motion-sensitive lights. Properly angled/aimed it will only activate when you expect it to and these...