 #include <ESP8266WiFi.h>
 #include <WiFiClient.h>
 #include <ESP8266WebServer.h>
+#include <PubSubClient.h>
 #include "./DNSServer.h"      // patched lib
 #include <FS.h>
 #include <OneWire.h>

    if(SEND_DATA) {                     // push data to the cloud
      postSensorData(&monitorData[monitorCursor]); yield();
    }
      
    if(++monitorCursor == MONITOR_POINTS)
      monitorCursor = 0;
  }

  Serial.println("");
  return;
}
void sendSensorData(monitor_t *monitorData) {
  Serial.println("\nsendSensorData");
  WiFiClient wclient;
  PubSubClient client(wclient, svrAddr);
  client.set_callback(callback); // Register MQTT callback
  if (client.connect("arduinoClient")) {
    if(GOT_TEMP_SENSOR){
      String wc;
      wc.concat(monitorData->waterCelsius);
      client.publish("WaterTemp",wc);
    }
    if(GOT_HUMID_SENSOR){
      String ac,hm;
      ac.concat(monitorData->airCelsius);
      hm.concat(monitorData->airHumid);
      client.publish("AirTemp",ac);
      client.publish("Humidity",hm);
    }  
    if(GOT_LIGHT_SENSOR){
      String lx;
      lx.concat(monitorData->lux);
      client.publish("Light",lx);
    }
    if(GOT_PH_SENSOR){
      String ph;
      ph.concat(monitorData->pH);
      client.publish("pH",ph);
    }
    if(GOT_LEVEL_SENSOR){
      String wl1, wl2, wl3;
      wl1.concat(monitorData->waterLevel1);
      wl2.concat(monitorData->waterLevel2);
      wl3.concat(monitorData->waterLevel3);
      client.publish("WaterLevel1",wl1);
      client.publish("WaterLevel2",wl2);
      client.publish("WaterLevel3",wl3);
    }
  }
  return;
}

void formatMonitorEntry(monitor_t *m, String* buf, bool JSON) {
  if(JSON) buf->concat("{ ");
  buf->concat("~timestamp~+ ");
