       }
 
       if (((millis() - sentMills) > REPORT_INTERVAL ) && ( irStatus == oldirStatus )) {
-        sendmqttMsg(topic, payload);
+      sendmqttMsg(topic, payload);
         sentMills = millis();
       }
 
       if ( irStatus != oldirStatus ) {
-        sendmqttMsg(topic, payload);
+      sendmqttMsg(topic, payload);
         sentMills = millis();
         oldirStatus = irStatus ;
         oldrevValue = revValue ;


  if (( millis() - startMills ) < 600 ) {
    return;
    /*
      }

      if (( millis() - startMills ) < ( revMills / 3 )) {
       return;
    */
  } else {
    revMills   = (millis() - startMills)  ;
    startMills = millis();

        average = ave.mean();
      }

      if ( revMills > 600 ) {
      revValue = (float(( 3600  * 1000 ) / ( 600 * float(revMills) ) ) * 1000);
      }

      if ( oldrevValue == 0 ) {
      oldrevValue = revValue;
    }

    if ( oldrevMills == 0 ) {
      oldrevMills = revMills;
    }

    payload = "{\"VIrms\":";
              payload += average;
              payload += ",\"revValue\":";
              payload += revValue;
              payload += ",\"revMills\":";
              payload += revMills;
              payload += ",\"powerAvg\":";
              payload += (( average + revValue ) / 2) ;
              payload += ",\"Stddev\":";
              payload += ave.stddev();
              payload += ",\"calcIrmsmillis\":";
              payload += calcIrmsmillis;
              payload += ",\"revCounts\":";
              payload += revCounts;
              payload += ",\"FreeHeap\":";
              payload += ESP.getFreeHeap();
              payload += ",\"RSSI\":";
              payload += WiFi.RSSI();
              payload += ",\"millis\":";
              payload += (millis() - timemillis);
              payload += "}";

    if ( doorStatus != olddoorStatus ) {

      doorpayload = "{\"DOOR\":";

      if ( doorStatus == 0 ) {
          doorpayload += "\"CLOSED\"";
        }
        else {
