 
 // ********** change MQTT_KEEPALIVE to 60 at PubSubClient.h *****************
 EnergyMonitor emon1;
-Average<float> ave(10);
+Average<float> ave(4);
 
 // mqtt
 char* topic = "esp8266/arduino/s07";

  revValue  = 0 ;
  oldrevMills = 0 ;
  oldrevValue = 0 ;

  pinMode(IRPIN, INPUT);
  pinMode(DOORPIN, INPUT_PULLUP);

  doorStatus = digitalRead(DOORPIN);
  olddoorStatus = doorStatus;

  attachInterrupt(4, IRCHECKING_START, RISING);
  attachInterrupt(5, DOORCHECKING, CHANGE);

  emon1.current(A0, 75);
  oldirStatus = LOW ;


  //OTA

    return;
  }

  if (( millis() - startMills ) < ( revMills / 3 )) {
    return;
  } else {
    revMills   = (millis() - startMills)  ;
    startMills = millis();
    irStatus   = !irStatus ;
    revCounts++;
  }

}

