test if the magnetic switch is near the magnet