Esp8266 reconnection

I want to report an issue that I have faced
There is one problem in blynk library
I am using esp8266 as shield on Arduino pro mini
The problem is that
If somehow my WiFi disconnect or my esp8266 modules resets then it is not automatically connected back to WiFi
The only way to make it connect back is by resetting Arduino
This problem should be fixed
I think the library should check if the esp8266 is. Connected to WiFi or not and then send the commands or communicate
Or there should be a command which one can put in his code to establish a connection to WiFi and server when the command is called

I also got the invalid auth token blynk error when connecting.
I used Tzapu’s wifimanager library
I want esp8266 to disconnect automatically to reconnect.
Please help me!

It is already… use the non-blocking Blynk.config() and your own WiFi setup.

It is not as seamless when using a ESP as shield, but that is due the nature of the shield use (as the ESP becomes a simple Serial to WiFi transceiver, then not directly programmable), not really a Blynk issue.

Many topics and examples already exist in this forum about how to use devices, with or without internet.

For example (again, primarily for ESP standalone, but try it with your arduino and see)…

I use similar connection with my Mega and ESP-01 as shield…

  wifi.setDHCP(1, 1, 1); //Enable dhcp in station mode and save in flash of esp8266
  Blynk.config(wifi, auth, server, port);
  if (Blynk.connectWiFi(ssid, pass)) {
    Blynk.connect();
  }
void loop() {
  timer.run();

  if (Blynk.connected()) {  // If connected run as normal
    Blynk.run();
  } else if (ReCnctFlag == 0) {  // If NOT connected and not already trying to reconnect, set timer to try to reconnect in 60 seconds
    ReCnctFlag = 1;  // Set reconnection Flag
    Serial.println("Starting reconnection timer in 30 seconds...");
    timer.setTimeout(30000L, []() {  // Lambda Reconnection Timer Function
      ReCnctFlag = 0;  // Reset reconnection Flag
      wifi.setDHCP(1, 1, 1); //Enable dhcp in station mode and save in flash of esp8266
      Blynk.config(wifi, auth, server, port);
      Blynk.connect();  // Try to reconnect to the server
      if (Blynk.connectWiFi(ssid, pass)) {
        Blynk.connect();
      }
    });  // END Timer Function
  }
}

I also got the invalid auth token blynk error when connecting.
I used Tzapu’s wifimanager library
I want esp8266 to disconnect automatically to reconnect.
Please help me!

[Unformatted code removed by moderator]

@ihome please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

@ihome As you’ve not been back to fix your code formatting your code has been removed.
As this is a 2 year old topic I’ve closed it. If you wish to create a new topic explain your problem in detail then please go ahead, and format your code correctly when you post it.

Pete.