No response from blynk.begin with local server

In blynk local servers while connecting through esp32 board blynk.begin line is no response,
How to test why in that line stopped or any other resolution for this

Are you using the correct syntax for Blynk.begin, specifying the correct IP address and port for your local server?

Is your local server running?

Is the device on the same network as your local server, and if not have you set-up port forwarding, a DDNS service and a DDNS update client?

Are you using the 0.6.1 library?

Are you using an auth token generated by your local server?

What does your serial monitor show?

What do your server logs show?

Pete.

hi Pete,
Here is the code block

/**********************************************************************************
 *  TITLE: ESP32 Home Automation project using Blynk | Internet & Manual control with Realtime Feedback | 8-CHANNEL RELAY
 *  Click on the following links to learn more. 
 *  YouTube Video: https://youtu.be/o1e5s_5p3FU
 *  Related Blog : https://iotcircuithub.com/blynk-esp32-home-automation/
 *  by Tech StudyCell
 **********************************************************************************/
/*************************************************************
  Update the Preferences –> Aditional boards Manager URLs: 
  https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json
  
  Note: This requires ESP32 support package:
    https://github.com/espressif/arduino-esp32
    
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

 *************************************************************
  
  Change WiFi ssid, pass, and Blynk auth token to run :)
  
  Please be sure to select the right ESP32 module
  in the Tools -> Board menu!

 *************************************************************/

#include <BlynkSimpleEsp32.h>

BlynkTimer timer;

// define the GPIO connected with Relays and switches
#define RelayPin1 23  //D23
#define RelayPin2 22  //D22
#define RelayPin3 21  //D21
#define RelayPin4 19  //D19
#define RelayPin5 18  //D18
#define RelayPin6 5   //D5
#define RelayPin7 25  //D25
#define RelayPin8 26  //D26

#define SwitchPin1 13  //D13
#define SwitchPin2 12  //D12
#define SwitchPin3 14  //D14
#define SwitchPin4 27  //D27
#define SwitchPin5 33  //D33
#define SwitchPin6 32  //D32
#define SwitchPin7 15  //D15
#define SwitchPin8 4   //D4

#define wifiLed    2   //D2

#define VPIN_BUTTON_1    V1 
#define VPIN_BUTTON_2    V2
#define VPIN_BUTTON_3    V3 
#define VPIN_BUTTON_4    V4
#define VPIN_BUTTON_5    V5 
#define VPIN_BUTTON_6    V6
#define VPIN_BUTTON_7    V7 
#define VPIN_BUTTON_8    V8

int toggleState_1 = 1; //Define integer to remember the toggle state for relay 1
int toggleState_2 = 1; //Define integer to remember the toggle state for relay 2
int toggleState_3 = 1; //Define integer to remember the toggle state for relay 3
int toggleState_4 = 1; //Define integer to remember the toggle state for relay 4
int toggleState_5 = 1; //Define integer to remember the toggle state for relay 5
int toggleState_6 = 1; //Define integer to remember the toggle state for relay 6
int toggleState_7 = 1; //Define integer to remember the toggle state for relay 7
int toggleState_8 = 1; //Define integer to remember the toggle state for relay 8

int wifiFlag = 0;

#define AUTH "rF4DENoNRv2XxdEJmGsKXSC-flqUG2I-"                 // You should get Auth Token in the Blynk App.  
#define WIFI_SSID "Kiran"             //Enter Wifi Name
#define WIFI_PASS "Home14324"         //Enter wifi Password


void relayOnOff(int relay){

    switch(relay){
      case 1: 
             if(toggleState_1 == 1){
              digitalWrite(RelayPin1, LOW); // turn on relay 1
              toggleState_1 = 0;
              Serial.println("Device1 ON");
              }
             else{
              digitalWrite(RelayPin1, HIGH); // turn off relay 1
              toggleState_1 = 1;
              Serial.println("Device1 OFF");
              }
             delay(100);
      break;
      case 2: 
             if(toggleState_2 == 1){
              digitalWrite(RelayPin2, LOW); // turn on relay 2
              toggleState_2 = 0;
              Serial.println("Device2 ON");
              }
             else{
              digitalWrite(RelayPin2, HIGH); // turn off relay 2
              toggleState_2 = 1;
              Serial.println("Device2 OFF");
              }
             delay(100);
      break;
      case 3: 
             if(toggleState_3 == 1){
              digitalWrite(RelayPin3, LOW); // turn on relay 3
              toggleState_3 = 0;
              Serial.println("Device3 ON");
              }
             else{
              digitalWrite(RelayPin3, HIGH); // turn off relay 3
              toggleState_3 = 1;
              Serial.println("Device3 OFF");
              }
             delay(100);
      break;
      case 4: 
             if(toggleState_4 == 1){
              digitalWrite(RelayPin4, LOW); // turn on relay 4
              toggleState_4 = 0;
              Serial.println("Device4 ON");
              }
             else{
              digitalWrite(RelayPin4, HIGH); // turn off relay 4
              toggleState_4 = 1;
              Serial.println("Device4 OFF");
              }
             delay(100);
      break;
      case 5: 
             if(toggleState_5 == 1){
              digitalWrite(RelayPin5, LOW); // turn on relay 5
              toggleState_5 = 0;
              Serial.println("Device5 ON");
              }
             else{
              digitalWrite(RelayPin5, HIGH); // turn off relay 5
              toggleState_5 = 1;
              Serial.println("Device5 OFF");
              }
             delay(100);
      break;
      case 6: 
             if(toggleState_6 == 1){
              digitalWrite(RelayPin6, LOW); // turn on relay 6
              toggleState_6 = 0;
              Serial.println("Device6 ON");
              }
             else{
              digitalWrite(RelayPin6, HIGH); // turn off relay 6
              toggleState_6 = 1;
              Serial.println("Device6 OFF");
              }
             delay(100);
      break;
      case 7: 
             if(toggleState_7 == 1){
              digitalWrite(RelayPin7, LOW); // turn on relay 7
              toggleState_7 = 0;
              Serial.println("Device7 ON");
              }
             else{
              digitalWrite(RelayPin7, HIGH); // turn off relay 7
              toggleState_7 = 1;
              Serial.println("Device7 OFF");
              }
             delay(100);
      break;
      case 8: 
             if(toggleState_8 == 1){
              digitalWrite(RelayPin8, LOW); // turn on relay 8
              toggleState_8 = 0;
              Serial.println("Device8 ON");
              }
             else{
              digitalWrite(RelayPin8, HIGH); // turn off relay 8
              toggleState_8 = 1;
              Serial.println("Device8 OFF");
              }
             delay(100);
      break;
      default : break;      
      }  
}

void with_internet(){
   
    //Manual Switch Control
    if (digitalRead(SwitchPin1) == LOW){
      delay(200);
      relayOnOff(1); 
      Blynk.virtualWrite(VPIN_BUTTON_1, toggleState_1);   // Update Button Widget  
    }
    else if (digitalRead(SwitchPin2) == LOW){
      delay(200);
      relayOnOff(2);      
      Blynk.virtualWrite(VPIN_BUTTON_2, toggleState_2);   // Update Button Widget
    }
    else if (digitalRead(SwitchPin3) == LOW){
      delay(200);
      relayOnOff(3);
      Blynk.virtualWrite(VPIN_BUTTON_3, toggleState_3);   // Update Button Widget
    }
    else if (digitalRead(SwitchPin4) == LOW){
      delay(200);
      relayOnOff(4);
      Blynk.virtualWrite(VPIN_BUTTON_4, toggleState_4);   // Update Button Widget
    }
    else if (digitalRead(SwitchPin5) == LOW){
      delay(200);
      relayOnOff(5); 
      Blynk.virtualWrite(VPIN_BUTTON_5, toggleState_5);   // Update Button Widget  
    }
    else if (digitalRead(SwitchPin6) == LOW){
      delay(200);
      relayOnOff(6);      
      Blynk.virtualWrite(VPIN_BUTTON_6, toggleState_6);   // Update Button Widget
    }
    else if (digitalRead(SwitchPin7) == LOW){
      delay(200);
      relayOnOff(7);
      Blynk.virtualWrite(VPIN_BUTTON_7, toggleState_7);   // Update Button Widget
    }
    else if (digitalRead(SwitchPin8) == LOW){
      delay(200);
      relayOnOff(8);
      Blynk.virtualWrite(VPIN_BUTTON_8, toggleState_8);   // Update Button Widget
    }
}
void without_internet(){
   Serial.println("WiFi Not without_internet");
    //Manual Switch Control
    if (digitalRead(SwitchPin1) == LOW){
      delay(200);
      relayOnOff(1);      
    }
    else if (digitalRead(SwitchPin2) == LOW){
      delay(200);
      relayOnOff(2);
    }
    else if (digitalRead(SwitchPin3) == LOW){
      delay(200);
      relayOnOff(3);
    }
    else if (digitalRead(SwitchPin4) == LOW){
      delay(200);
      relayOnOff(4);
    }
    else if (digitalRead(SwitchPin5) == LOW){
      delay(200);
      relayOnOff(5);      
    }
    else if (digitalRead(SwitchPin6) == LOW){
      delay(200);
      relayOnOff(6);
    }
    else if (digitalRead(SwitchPin7) == LOW){
      delay(200);
      relayOnOff(7);
    }
    else if (digitalRead(SwitchPin8) == LOW){
      delay(200);
      relayOnOff(8);
    }
}

BLYNK_CONNECTED() {
  // Request the latest state from the server
  Blynk.syncVirtual(VPIN_BUTTON_1);
  Blynk.syncVirtual(VPIN_BUTTON_2);
  Blynk.syncVirtual(VPIN_BUTTON_3);
  Blynk.syncVirtual(VPIN_BUTTON_4);
  Blynk.syncVirtual(VPIN_BUTTON_5);
  Blynk.syncVirtual(VPIN_BUTTON_6);
  Blynk.syncVirtual(VPIN_BUTTON_7);
  Blynk.syncVirtual(VPIN_BUTTON_8);
}

// When App button is pushed - switch the state

BLYNK_WRITE(VPIN_BUTTON_1) {
  toggleState_1 = param.asInt();
  digitalWrite(RelayPin1, toggleState_1);
}

BLYNK_WRITE(VPIN_BUTTON_2) {
  toggleState_2 = param.asInt();
  digitalWrite(RelayPin2, toggleState_2);
}

BLYNK_WRITE(VPIN_BUTTON_3) {
  toggleState_3 = param.asInt();
  digitalWrite(RelayPin3, toggleState_3);
}

BLYNK_WRITE(VPIN_BUTTON_4) {
  toggleState_4 = param.asInt();
  digitalWrite(RelayPin4, toggleState_4);
}

BLYNK_WRITE(VPIN_BUTTON_5) {
  toggleState_5 = param.asInt();
  digitalWrite(RelayPin5, toggleState_5);
}

BLYNK_WRITE(VPIN_BUTTON_6) {
  toggleState_6 = param.asInt();
  digitalWrite(RelayPin6, toggleState_6);
}

BLYNK_WRITE(VPIN_BUTTON_7) {
  toggleState_7 = param.asInt();
  digitalWrite(RelayPin7, toggleState_7);
}

BLYNK_WRITE(VPIN_BUTTON_8) {
  toggleState_8 = param.asInt();
  digitalWrite(RelayPin8, toggleState_8);
}


void checkBlynkStatus() { // called every 3 seconds by SimpleTimer

  bool isconnected = Blynk.connected();
  if (isconnected == false) {
    wifiFlag = 1;
  //  digitalWrite(wifiLed, LOW); //Turn off WiFi LED
    Serial.println("WiFi Not Connected-11");
  }
  if (isconnected == true) {
    wifiFlag = 0;
    //digitalWrite(wifiLed, HIGH); //Turn on WiFi LED
    Serial.println("WiFi Not Connected-12");
  }
}
void setup()
{
  Serial.begin(115200);

  pinMode(RelayPin1, OUTPUT);
  pinMode(RelayPin2, OUTPUT);
  pinMode(RelayPin3, OUTPUT);
  pinMode(RelayPin4, OUTPUT);
  pinMode(RelayPin5, OUTPUT);
  pinMode(RelayPin6, OUTPUT);
  pinMode(RelayPin7, OUTPUT);
  pinMode(RelayPin8, OUTPUT);

  pinMode(wifiLed, OUTPUT);

  pinMode(SwitchPin1, INPUT_PULLUP);
  pinMode(SwitchPin2, INPUT_PULLUP);
  pinMode(SwitchPin3, INPUT_PULLUP);
  pinMode(SwitchPin4, INPUT_PULLUP);
  pinMode(SwitchPin5, INPUT_PULLUP);
  pinMode(SwitchPin6, INPUT_PULLUP);
  pinMode(SwitchPin7, INPUT_PULLUP);
  pinMode(SwitchPin8, INPUT_PULLUP);

  //During Starting all Relays should TURN OFF
  digitalWrite(RelayPin1, toggleState_1);
  digitalWrite(RelayPin2, toggleState_2);
  digitalWrite(RelayPin3, toggleState_3);
  digitalWrite(RelayPin4, toggleState_4);
  digitalWrite(RelayPin5, toggleState_5);
  digitalWrite(RelayPin6, toggleState_6);
  digitalWrite(RelayPin7, toggleState_7);
  digitalWrite(RelayPin8, toggleState_8);
Serial.println("setup1");
  WiFi.begin(WIFI_SSID, WIFI_PASS);
Serial.println("setup3");
timer.setInterval(3000L, checkBlynkStatus); // check if Blynk server is connected every 3 seconds
 Serial.println("setup4");
 //Blynk.config(AUTH);
  Blynk.begin(AUTH, WIFI_SSID, WIFI_PASS, IPAddress(192,168,0,100), 8080);
Serial.println("Setup2");
}

void loop()
{  
  if (WiFi.status() != WL_CONNECTED)
  {
    Serial.println("WiFi Not Connected");
  }
  else
  {
    //Serial.println("WiFi Connected");
    Blynk.run();
  }

  timer.run(); // Initiates SimpleTimer
  if (wifiFlag == 0)
    with_internet();
  else
    without_internet();
}

serial monitor output:
setup1
setup3
setup4

here attached the screen shot of console log and it shows all the serial.println before blynk.begin are success but not getting serial.println(“Setup2”) which is blocked by blynk.begin

in my mobile phone, i had blynk app and that app connecting to my local blynk server , which indicates it server is running properly and able to login blynk server web admin also

auth code is also correct, both server, mobile and device all are in same network

how to check the blynk server version i am not sure?

earlier it was working fine but now not able to connecting server and that mobile app showing not connected
please help me

@Kiran_Raju 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:
```

Also, please copy the serial output text and paste it between triple backticks as well, rather than posting screenshots.

Pete.

@Kiran_Raju let me know when you’ve sorted-out the formatting of your post and I’ll respond to it.

Pete.

done with formatting

Your sketch seems to have been converted from using Blynk.config & Blynk.connect to using Blynk.begin. I doubt very much whether the Blynk.config code would have worked, but this line of code…

doesn’t belong in your sketch as it stands.

Also, this timer would be better initialised AFTER your Blynk.begin command…

and there is a good chance that the timer isn’t needed at all when using Blynk.begin rather than the config/connect command.
But, it’s impossible to say based on the snippet of code you’ve posted.

Pete.

hi Pete,

updated the post with full code, so it will gives better picture where it went wrong,

please check and suggest the solution

First of all, have you made the change I suggested and tested it?

Pete.

yes, i did below changes and tested but no luck,
moved the timer.setinterval next to the Blynk.begin and tried but no luck still same

Serial.println("setup4");

  Blynk.begin(AUTH, WIFI_SSID, WIFI_PASS, IPAddress(192,168,0,100), 8080);
  Serial.println("setup3");
timer.setInterval(3000L, checkBlynkStatus); // check if Blynk server is connected every 3 seconds

is any other change need to do apart from the above one, i am able to understand only this from your suggestion,
if you suggested any other change, if i missed it please help me once again explaining that change

Yes, delete the WiFi.Begin command.

TBH, your sketch is a complete mess, and will never run as intended when using the blocking Blynk.begin() command. It also has some significant logic flaws if you reverted back to Blynk.config/connect.

A bit of background would be useful. I assume that it’s not your code, and that you’ve set-up a local legacy server for a reason?

Pete.

Hi @PeteKnight ,

Yes this code copied from some online resource and did the setup for the local blynk server.

As per your suggestion, removed the Wifi.Begin Command but no luck,

if you don’t mine, could you please help me by sharing your Skype id or any other way to check my issue.

please help me on just half an hour by any online meeting…

Yes, I do mind.

I’d suggest that you provide as much information as possible about your local server setup, as well as information about what code you were using when it was working correctly, and what has changes since.

I’ve asked quite a few questions that you haven’t answered, so you’re not really doing much to help yourself when it comes to providing information.

Pete.