You need to connect some extra pins to VCC or GND if you use a bare ESP-12-f, google for this. :)
Connect D0 to vcc, to ensure the device goes into deep sleep. (connect to GND to disable deep sleep)
Connect the magnetic switch:
Connect one side of the magnetic switch to GND.
Connect the other side of switch it to the - side of a capacitor (4u7), with a 1 meg. resistor in parallel.
Connect those the the RST pin.
This will wake up the ESPEasy from deep sleep when the magnetic switch is closed.