       } else {
         pls_p = 0;
       }
-      send_raw_data();
+      //send_raw_data();
+      sendtoInfluxdb();
       bdata_is_rdy = false;
     }
-
-    /*
-      if (!client.connected()) {
+    if (!client.connected()) {
       syslogPayload = "failed, rc= ";
       syslogPayload += client.state();
       sendUdpSyslog(syslogPayload);

        bdoor_status = sensor_data.door;
      }

      if (_salt != sensor_data._salt) {
        payload = "{\"_salt\":";
        payload += sensor_data._salt;
        payload += ",\"pls_no\":";
        payload += sensor_data.pls_no;
        payload += ",\"pls_time\":";
        payload += sensor_data.pls_wh;
        payload += ",\"ct1\":";
        payload += sensor_data.ct1_wh;
        payload += ",\"ct2\":";
        payload += sensor_data.ct2_wh;
        payload += ",\"ct3\":";
        payload += sensor_data.ct3_wh;
        payload += ",\"powerAvg\":";
        payload += (( sensor_data.ct2_wh + sensor_data.ct3_wh ) / 2) ;
        payload += ",\"FreeHeap\":";
        payload += ESP.getFreeHeap();
        payload += ",\"RSSI\":";

  sendUdpSyslog(syslogPayload);
}

void ICACHE_RAM_ATTR sendtoInfluxdb() {
  String udppayload = "emontxv2,device=esp-01 ";
  udppayload += "F=";
  udppayload += ESP.getCpuFreqMHz();
  udppayload += "i,pls_no=";
  udppayload += sensor_data.pls_no;
  udppayload += "i,pls_ts=";
  udppayload += sensor_data.pls_ts;
  udppayload += "i,pls_p=";
  udppayload += pls_p;
  udppayload += "i,ct1_rp=";
  udppayload += sensor_data.ct1_rp;
  udppayload += "i,ct1_ap=";
  udppayload += sensor_data.ct1_ap;
  udppayload += "i,ct1_vr=";
  udppayload += sensor_data.ct1_vr;
  udppayload += "i,ct1_ir=";
  udppayload += sensor_data.ct1_ir;
  udppayload += "i,ct2_rp=";
  udppayload += sensor_data.ct2_rp;
  udppayload += "i,ct3_rp=";
  udppayload += sensor_data.ct3_rp;
  udppayload += "i,door=";
  udppayload += sensor_data.door;
  udppayload += "i";

  sendUdpmsg(udppayload);
}

bool ICACHE_RAM_ATTR get_i2c_data() {
  if (digitalRead(DATA_IS_RDY_PIN)) {
    pinMode(DATA_IS_RDY_PIN, OUTPUT);
    digitalWrite(DATA_IS_RDY_PIN, LOW);
