Automatic light switch, the diagram of which is shown, includes incandescent lamp EL1 when you open the door the utility room, leave it up permanently locked from the inside when the door latch and turns off after the man left the room.

Reed SF1 installed on the door frame. The contacts are closed when closed the door under the action field is set on it magnet. While internal door the latch is not locked, mechanically connected to the switch SA1 is open. Transistors VT1, VT2 and triac VS1 closed, lamp EL1 disconnected from the network.
When you open the door open the contacts of the reed switch and start charging capacitors C3 and C4. After 1… 1,5 with the voltage on the capacitor C4 will be sufficient to open the transistor and triac and the lamp EL1 will be included. Charging the capacitors goes on for a while and only after capacitor C4 discharges through resistor R5. As a result, after 30…40 lamp EL1 goes out.
If you close the door (without locking it on the latch), the discharge of capacitor C4 starts immediately and the lamp will turn off in approximately 10 s. in Order to light it again, enough to open the door for a few seconds (sufficient time to discharge capacitor C3 through the closed contacts of the reed switch SF1, resistor R4 and diode VD5).
When locked, the door latch lamp EL1 will be lit and will Shine constantly, regardless of door position. In this case, the opening voltage is supplied to the base of transistor VT1 through the resistor R3 and the closed contacts of the switch SA1.
The lamp EL1 can be turned on and the switch SA2. It can be "regular" or wall specially installed. Use it, if you want to permanently turn on the lights in the room with the door open. There is another option. Installing this the switch in such a way that the contacts were closed when the door is open (in the fridge), you can not worry about turning on and off light if you come into the room for a short time, leaving the door open.
In design it is possible to use transistors KT361 with alphabetical index - E or other low-power structure of p-n-p, for example, MP25B. Diodes VD1, VD2, VD5, VD6 - KD105B or DB. Zener DG (VD3, VD4) can be replaced by DV. Capacitor C1 - K73-17 or MBGC, oxide - K50-35.
The reed switch is placed in a plastic housing (e.g., security udatsya alarm system SMK-1) and fixed on the door frame. The magnet is mounted on door. The switch SA1 is mounted so that its contacts are closed when I lock my door on the latch.
Fuse FU1 is necessary to protect the triac VS1 burnout lamp EL1. At this point inside the lamp, as a rule, occur electric arc and the current through the triac VS1, increasing to dangerous values.
Author: A. Ivkin, Istra, Moscow region.