The door magnetism is consisted of switches and magnet; switch is connected with magnetic reed switch by lead wire, and set encapsulation.
Make the magnet corresponding to the magnetic field intensity, and packaged into the plastic or alloy shell.
When parts separated or approached is to certain distance, it will lead to the on/off to sense the changes of switch position.