Room automation light control - programming problem

But how will I be able to run this part of the program only one time, without repeating it over and over again. Since that my door probably will be open longer then 1,5 seconds i don't want my Arduino to keep on sending a signal to my mainlight.

You need to detect when the switch transitions from released to pressed, or from released to pressed. How do you detect this?

Simple. The current state of the switch is not the same as the previous state of the switch. This implies, of course, that you need to keep track of the previous state of the switch.

And this is a good time to point out that meaningful names for variables are a really good idea.

doorSensor is not a good name. Is that supposed to be a pin number or a state? A good name would eliminate that ambiguity. doorSensorPin and doorSensorState would be better names. Of course, the door sensor is really a switch, so doorSwitchPin and doorSwitchState would be even better.