No blynk update nodemcu "weathersation"

Hello everybody,
I’m building a weather stattion based on Nodemcu, I have DHT11 and BMP085 sensors. Datas are displayed on a 4 digit display.
Everything is working fine for serial monitor and the digit display.
I’ve been trying to connect it to Blynk, I can see it’s connected in the app, first time it connects I’ve got the right values displayed bu after that it never updates in spite of the device disconnecting then connecting.

I join my code, it’s a bit messy and long and it nearly works…

If you have an idea why it’s not fully working, please tell me ! Thank you

#include <TM1637Display.h>
    #include <Adafruit_Sensor.h>
    #include <DHT.h>
    #include <TM1637.h>
    #include <NTPClient.h>
    #include <ESP8266WiFi.h>
    #include <WiFiUdp.h>
    #include <time.h>
    #include <BlynkSimpleEsp8266.h>
    #include <Wire.h>
    #include <Adafruit_BMP085.h>

    #define BLYNK_PRINT Serial    // Comment this out to disable prints and save space

Adafruit_BMP085 bmp;
//#define I2C_SCL 4
//#define I2C_SDA 5
const int I2C_SDA = D2; //Set the CLK pin connection to the display
const int I2C_SDL = D1;

float dst,bt,bp,ba;
char dstmp[20],btmp[20],bprs[20],balt[20];
bool bmp085_present=true;

    char auth[] = "xxxx";


    const char *ssid     = "xxxx";
    const char *password = "xxxx";

    const long utcOffsetInSeconds = 3600;
    int hours;
    int minutes;
    String formattedDate;
    String dayStamp;
    String monthStamp;
    String timeStamp;

    String getFullFormattedTime(); 

    int getYear();
    int getMonth(); 
    int getDate();

         
    WiFiUDP ntpUDP;
    NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds);

   
    
    //const long utcOffsetInSeconds = 3600;
    
    // Define the connections pins pour TM1637et DHT:
    #define DHTPIN 2
    const int CLK = D7; //Set the CLK pin connection to the display
    const int DIO = D6; //Set the DIO pin connection to the display

    TM1637 tm1637(CLK, DIO);
    
 
    // Create variable:
    int temperature_celsius;
    float humidity_float;
    int humidity;
    
    // Symbole "t":
    const uint8_t temp[] = {
      SEG_F | SEG_E | SEG_G | SEG_D,  // t
    };
    
    // Symbole "h":
    const uint8_t hum[] = {
      SEG_F | SEG_E | SEG_G | SEG_C,  // h
    };
    
    // Set DHT type, uncomment whatever type you're using!
    #define DHTTYPE DHT11   // DHT 11 
    //#define DHTTYPE DHT22   // DHT 22  (AM2302)
    //#define DHTTYPE DHT21   // DHT 21 (AM2301)
    
    // Create display object of type TM1637Display:
    TM1637Display display = TM1637Display(CLK, DIO);
   
    // Create dht object of type DHT:
    DHT dht = DHT(DHTPIN, DHTTYPE);
    BlynkTimer timer;
    
   void sendSensor()
{
if (!bmp.begin()) 
  {
           Serial.println("Could not find a valid BMP085 sensor, check wiring!");
              while (1) {}
        }
temperature_celsius = dht.readTemperature();
      humidity_float = dht.readHumidity();
      humidity = humidity_float;
  //double gamma = log(h/100) + ((17.62*t) / (243.5+t));
  //double dp = 243.5*gamma / (17.62-gamma);

float bp =  bmp.readPressure()/100;
float ba =  bmp.readAltitude();
float bt =  bmp.readTemperature();
float dst = bmp.readSealevelPressure()/100;
  
  Blynk.virtualWrite(V5, temperature_celsius);
  Blynk.virtualWrite(V6, humidity);
  Blynk.virtualWrite(V10, bmp.readPressure()/100);
 }
    
    
    void setup() {
      const int I2C_SDA = D2; //Set the CLK pin connection to the display
      const int I2C_SCL = D1;
      Wire.begin(4, 5);
      delay(2000);
      Serial.begin(9600);
      Blynk.begin(auth, ssid, password);
      dht.begin();
      delay(10);
      timer.setInterval(1000L, sendSensor);
      // Set the display brightness (0-7):
      display.setBrightness(0);
      // Clear the display:
      display.clear();
      // Setup sensor:
      
      // Begin serial communication at a baud rate of 9600:
      
      // Wait for console opening:
      //delay(2000);

      WiFi.begin(ssid, password);

  while ( WiFi.status() != WL_CONNECTED ) {
    delay ( 500 );
    //Serial.print ( "." );
  }

  timeClient.begin();
}



    void loop() {

      Blynk.run(); // Initiates Blynk
      timer.run(); // Initiates SimpleTimer
           
      //timeClient.update();

      while(!timeClient.update()) {
      timeClient.forceUpdate();
  }

      // heures + minutes:

      hours = timeClient.getHours();
      minutes = timeClient.getMinutes();
         
      //date
      formattedDate = timeClient.getFormattedDate();
      int splitT = formattedDate.indexOf("T");
      dayStamp = formattedDate.substring(8, 10);
      monthStamp = formattedDate.substring(5, 7);
      dayStamp = dayStamp.toInt();
      monthStamp = monthStamp.toInt();
      
  
      // Read the temperature as Celsius and Fahrenheit:
      temperature_celsius = dht.readTemperature();
      humidity_float = dht.readHumidity();
      humidity = humidity_float;
      
      // Print datas to the Serial Monitor:
      Serial.println(formattedDate);
      Serial.println(temperature_celsius);
      Serial.println(humidity);
      Serial.println(bmp.readPressure()/100);
      
      // Show datas on the TM1637 display:
      display.showNumberDecEx(hours,0x40,true,2,0);
      display.showNumberDec(minutes, true,2,2);
      delay(5000);
      display.clear();
      display.showNumberDec(dayStamp.toInt(),true,2,0);
      display.showNumberDec(monthStamp.toInt(),true,2,2);
      delay(5000);
      display.clear();
      display.showNumberDec(temperature_celsius, false, 2, 2);
      display.setSegments(temp, 1,false);
      delay(5000);
      display.showNumberDec(humidity, false, 2, 2);
      display.setSegments(hum, 1,false);
      delay(5000);
      display.clear();
      display.showNumberDec(bmp.readPressure()/100,true);
      delay(5000);

      
    }


can you please format your code in the Arduino compiler with CTRL + T so it aligns properly?

You need to read this:

Pete.

You have many delay functions inside void loop() function, this will make hardware disconnect from server as Blynk.run() will run every long time (due to the delay).

when hardware is disconnected, any Blynk.virtualWrite will not update the server.

Please read help provided by @PeteKnight for details

Hello.
Thank you all for your answers.
If I try with millis instead of delay, will it do the job ?
Thank you
Jerome

You have also keep your void loop clean.

What do you mean Proietti ?
Can you give an example ?
Thank you

find from the link in post #3 by Pete