This low cost sensor saved me thousands of dollars in water damage repairs.
Door sensors detect door position (i.e., open or closed) based on the precise gap between the magnet and the reed switch.