I use
these for controlling LED lighting strips in closets and cabinets.
Unlike traditional magnetic switches commonly used with alarm systems (those open the circuit when the magnet moves away), the SPDT (Single Pole, Double Throw) magnetic switches can be connected to close the circuit when the magnet moves away.
I mount the magnet portion to the door near the top edge, typically closer to the hinge side than the latch side. The switch portion is attached to the door frame, as close as I can position so there are just a few mm gap.
When the door is opened only slightly the gap is still close enough that the switch does not activate. Open the door more fully and the light turns on.
Another gotcha is that a typical alarm system magnetic 'reed contact' is only rated for very low power, typically a few milliamperes at low voltages. To directly control LED lighting strips requires a much higher current capacity.
The Amseco AMS-38BWH magnetic switches are rated for 3 amps at 300 volts, but I have only used them with 12 volt lighting.
Amseco Surface Mount Magnetic Contact Form C White