     wifi_connect();
   }
 
-
-  /*
-    if (WiFi.status() == WL_CONNECTED) {
-      if (!client.connected()) {
-        if (DEBUG_PRINT) {
-          Serial.print("failed, rc=");
-          Serial.println(client.state());
-        }
-        long now = millis();
-        if (now - lastReconnectAttempt > 1000) {
-          lastReconnectAttempt = now;
-          if (reconnect()) {
-            lastReconnectAttempt = 0;
-          }
-        }
-      }
-    } else {
-      wifi_connect();
-    }
-
-  */
   if (timeStatus() != timeNotSet) {
     if (now() != prevDisplay) { //update the display only if time has changed
       prevDisplay = now();

  delay(20);

  //--
  H  = -1000 ;
  T1 = -1000 ;
  T2 = -1000 ;
  OT = -1000 ;
  PW = -1000 ;
  NW = -1000 ;
  PIR = 0 ;
  dustDensity = -1000 ;
  HO = 0 ;
  HL = 0;

  moisture = 0;

  unihost = 0;
  rsphost = 0;

  unitot = 0;
  rsptot = 0;

  OLD_H  = -1000 ;
  OLD_T1 = -1000 ;
  OLD_T2 = -1000 ;
  OLD_OT = -1000 ;
  OLD_PW = -1000 ;
  OLD_NW = -1000 ;
  OLD_PIR = 0 ;
  OLD_dustDensity = -1000 ;
  OLD_HO = 0;
  OLD_HL = 0;

  OLD_x = 0 ;

  lastReconnectAttempt = 0;
  resetCountforMqttReconnect = 0;

  getResetInfo = "hello from ESP8266 s03 ";
  getResetInfo += ESP.getResetInfo().substring(0, 30);

  Wire.endTransmission();
}

void sendmqttMsg(String payloadtosend)
{
  if (client.connected()) {
