Connecting to 0.0.0.0 but never connects to Blynk

  1. I have problem connecting it to wifi at first, then after I successful to connect to wifi then this happens (connecting to 0.0.0.0
  2. Add details :
    • Hardware model + communication type. : Esp32 DevKit
    • Smartphone OS (iOS)
    • Blynk local server
    • Blynk Library version <BlynkSimpleEsp32.h>
#define BLYNK_TEMPLATE_ID "TMPL61aPbFDQa"
#define BLYNK_TEMPLATE_NAME "Engineering Team project"
#define BLYNK_AUTH_TOKEN "7fVOMeBvzJduHrRjFVThc8kbQH59mbMC"

#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 13
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

char auth[] = BLYNK_AUTH_TOKEN;

char ssid[] = "test";  // type your wifi name
char pass[] = "12345678";  // type your wifi password

BlynkTimer timer;
int targetTemperature = 23;  // Target temperature in Celsius
int elapsedSeconds = 0;      // Variable to track time elapsed
float currentTemperature;   // Variable to store the current temperature
bool notificationSent = false;  // Variable to track if the notification has been sent

const int CONNECTION_TIMEOUT = 10;  // Connection timeout in seconds

void sendSensor()
{
  // Request temperature to all devices on the data line
  sensors.requestTemperatures();

  currentTemperature = sensors.getTempCByIndex(0);
  Serial.print("Celsius temperature: ");
  Serial.println(currentTemperature);

  Blynk.virtualWrite(V0, currentTemperature);

  if (currentTemperature < targetTemperature)
  {
    elapsedSeconds++;
    Serial.print("Elapsed Time (seconds): ");
    Serial.println(elapsedSeconds);

    float temperatureDifference = targetTemperature - currentTemperature;
    float rateOfChange = temperatureDifference / elapsedSeconds;
    float estimatedTime = temperatureDifference / rateOfChange;

    Serial.print("Estimated Time to Reach ");
    Serial.print(targetTemperature);
    Serial.print("C: ");

    if (estimatedTime < 60)
    {
      Serial.print(estimatedTime);
      Serial.println(" seconds");
    }
    else if (estimatedTime < 3600)
    {
      estimatedTime /= 60;
      Serial.print(estimatedTime);
      Serial.println(" minutes");
    }
    else if (estimatedTime < 86400)
    {
      estimatedTime /= 3600;
      Serial.print(estimatedTime);
      Serial.println(" hours");

      // Check if the estimated time reaches two hours left
      if (estimatedTime <= 2 && estimatedTime > 1 && !notificationSent)
      {
        Blynk.logEvent("Temperature Notification", "Only 2 hours left to reach the target temperature!");
        notificationSent = true;
      }
      // Check if the estimated time reaches one hour left
      else if (estimatedTime <= 1 && !notificationSent)
      {
        Blynk.logEvent("Temperature Notification", "Only 1 hour left to reach the target temperature!");
        notificationSent = true;
      }
    }
    else
    {
      estimatedTime /= 86400;
      Serial.print(estimatedTime);
      Serial.println(" days");
    }

    Blynk.virtualWrite(V1, estimatedTime);  // Send the estimated time to virtual pin V1 in the Blynk app

    // Check if the estimated time is up
    if (estimatedTime <= 0 && !notificationSent)
    {
      Blynk.logEvent("Temperature Notification", "Target temperature reached!");
      notificationSent = true;
    }
  }
}

void setup()
{
  Serial.begin(9600);
  Serial.println("Attempting to connect to WiFi...");

  sensors.begin();

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, pass);

  int timeout_counter = 0;
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(200);
    Serial.print(".");
    timeout_counter++;
    if (timeout_counter >= CONNECTION_TIMEOUT * 5)
    {
      ESP.restart();
    }
  }

  Serial.println("\nConnected to WiFi and Blynk server!");

  timer.setInterval(1000L, sendSensor);  // Run the sendSensor function every second
}

void loop()
{
  Blynk.run();
  timer.run();
}


You don’t have a Blynk.config(BLYNK_AUTH_TOKEN) command in your void setup.

Pete.