 #include <ESP8266mDNS.h>
 #include <ArduinoOTA.h>
 #include <WiFiUdp.h>
-
+#include <Average.h>
+
+extern "C" {
+#include "user_interface.h"
+}
 #include "/usr/local/src/ap_setting.h"
 #include "/usr/local/src/slack_setting.h"
-const char* otapassword = OTA_PASSWORD;
 
 const char* api_fingerprint = "AB F0 5B A9 1A E0 AE 5F CE 32 2E 7C 66 67 49 EC DD 6D 6A 38";
 

      ir_data.ac_mode   = 0;
      ir_data.timermode = false;
      ir_data.haveData  = true;
    }
    else if (String(text) == "ton")
    {


  irrecv.enableIRIn();


  // wifi connect
  wifi_connect();

  clientName = "esp8266-";
  uint8_t mac[6];
  WiFi.macAddress(mac);
  clientName += macToStr(mac);
  clientName += "-";
  clientName += String(micros() & 0xff, 16);

  // ntp update
  udp.begin(localPort);
  setSyncProvider(getNtpTime);

  if (timeStatus() == timeNotSet)
  {
    setSyncProvider(getNtpTime);
    delay(200);
  }

  // mqtt connect
  reconnect();

  //OTA
  // Port defaults to 8266
  ArduinoOTA.setPort(8266);
  ArduinoOTA.setHostname("esp-slackbot");
  ArduinoOTA.setPassword(OTA_PASSWORD);
  ArduinoOTA.onStart([]()
  {
    //sendUdpSyslog("ArduinoOTA Start");
