The same person still in the room shuts the door like our mommy's have learned us and the light goes off with that person still in the room.....
Some one enters the room and shuts the door, that is two times trigger and the lamp goes on.
Then someone else enters the room ?????
Lights go off .........
Use a pir and detect motion.
Will be an easier solution.
Luc