   VIrms = emon1.calcIrms(1480) * 220.0;
   ave.push(VIrms);
   average = ave.mean();
+
+  client.loop();
 
   if ( revMills > 600 ) {
     revValue = (float(( 3600  * 1000 ) / ( 600 * float(revMills) ) ) * 1000);

          lastReconnectAttempt = 0;
        }
      }
    } /* else {
      client.loop();
    } */
  } else {
    wifi_connect();
  }

}

boolean reconnect() {
  if (!client.connected()) {
    if (client.connect((char*) clientName.c_str(), willTopic, 0, true, willMessage)) {
      client.publish(willTopic, "1", true);
      client.publish(hellotopic, "hello again 1 from ESP8266 s07");
      if (DEBUG_PRINT) {
        Serial.println("---------------> connected");
      }
    } else {
      if (DEBUG_PRINT) {
        Serial.print("----------------> failed, rc=");
        Serial.println(client.state());
      }
    }
  }
  //timemillis = millis();
