Door alarms install over the seam of a door – opposite the hinges. Half of the sensor is attached to the door frame, while the other half is attached to the door. These halves stay connected magnetically while the door is closed, creating a closed circuit. When the door is opened, the two halves of the sensor come apart, as the magnets are no longer connected, and the circuit is opened up, triggering an alert or alarm.
This type of alarm can also be used on windows, referred to as a window alarm.