I made a arduino based project which can switch on the light when someone passes by the door to enter the room.it uses a ultrasonic sensor(distance sensor) to identify when someone cuts the wave and enters the room,then the servo switchs then button.This can be modified to turn of the light also,but for that you'll need two ultrasonic sensors to count the people entered the room and how many of them left the room so that it can operate accordingly.