 
 long lastReconnectAttempt = 0;
 long calcIrmsmillis = 0;
+
+void rtc_check()
+{
+  // system_rtc_mem_read(64... not work, use > 64
+  system_rtc_mem_read(100, &rtc_mem_revcount, sizeof(rtc_mem_revcount));
+  if (DEBUG_PRINT) {
+    Serial.print("=================> rtc mem mgic / salt :  ");
+    Serial.print(rtc_mem_revcount.magic);
+    Serial.print(" / ");
+    Serial.println(rtc_mem_revcount.salt);
+  }
+
+  if (rtc_mem_revcount.magic != RTC_MAGIC) {
+    if (DEBUG_PRINT) {
+      Serial.println("===============> rtc mem init...");
+    }
+    rtc_mem_revcount.magic = RTC_MAGIC;
+    rtc_mem_revcount.salt = 5255;
+  }
+}
 
 void wifi_connect() {
   // WIFI

    Serial.begin(115200);
  }
  delay(20);
  if (DEBUG_PRINT) {
    Serial.println("power meter test!");


      }

      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 {
