Deep Sleep WemosD1mini + Blynk+ Mag Reed Switch

Hello guys I would like to have a project so that when the reed switch is triggered the wemos d1 mini wakes up, connects to wifi, send message and then deep sleep until triggered again.

I have a working code which basically lets me know the door is open or close while the blynk app is open and also notifies me when the blynk app is not running using the notification feature.

I need help your help with deep sleep so instead of having a 5v usb power connected to wemos d1 mini all the time, i can use some sort of rechargable battery pack

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

bool current = 0;
bool previous = 1;

char auth[] = "";

char ssid[] = "";
char pass[] = "";

BlynkTimer Mytimer; 

void setup()
  // Debug console
  Blynk.begin(auth, ssid, pass);
  Mytimer.setInterval(1000L, switchstate); 
  pinMode(14, INPUT_PULLUP); //DOOR

void switchstate(){
  current = digitalRead(14);
  if (current != previous){
    previous = current;
    if (current == LOW)
              Blynk.virtualWrite(2, "Door closed.");
              Blynk.notify("Your Door is closed!!");
               Blynk.virtualWrite(2, "Door OPEN!");
               Blynk.notify("Your Door is OPEN!!");
void loop()

Take a look at this Github thread:

Several people seem to have similar requirements in this discussion.

Once the ESP is in deep sleep then I think it needs a LOW on the RST pin to wake it up. However, if its already awake and you apply a LOW signal to RST then it’s simply reset the ESP and if RST remains LOW then it’ll just keep rebooting until RST goes HIGH again. Not an ideal situation, especially if you’re trying to save power. This is where the flip/flop circuit in the discussion comes in.