 
 void setup() {
   Serial.begin(115200);
+  Serial.println();
+  Serial.println("Starting....... ");
   //Serial.setDebugOutput(true);
+
+  // ac
+  ir_data.ac_mode     = 0;
+  ir_data.ac_temp     = 27;
+  ir_data.ac_flow     = 1;
+  ir_data.haveData    = false;
+  ir_data.timermode   = false;
+  ir_data.timerfirst  = false;
+  ir_data.intervalon  = (AC_ON_MIN * 60 * 1000); // ms
+  ir_data.intervaloff = (AC_OFF_MIN * 60 * 1000); // min
+  ir_data.timerMillis = millis();;
+  nextTimercheck = ir_data.intervalon;
+
+  lgWhisen.setTemp(ir_data.ac_temp);    // 18 ~ 30
+  lgWhisen.setFlow(ir_data.ac_flow);    // 0 : low, 1 : mid, 2 : high, if setActype == 1, 3 : change
+  lgWhisen.setIrpin(IR_TX_PIN);         // ir tx pin
+
+  irrecv.enableIRIn();
 
   WiFi.mode(WIFI_STA);
   WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
-  while (WiFi.status() != WL_CONNECTED) {
+  while (WiFi.status() != WL_CONNECTED)
+  {
+    Serial.print(". ");
     delay(100);
   }
-
-  configTime(3 * 3600, 0, "pool.ntp.org", "time.nist.gov");
+  Serial.println();
+
+  configTime(9 * 3600, 0, "pool.ntp.org", "time.nist.gov");
 }
 
 unsigned long lastPing = 0;

const char* api_fingerprint = "AB F0 5B A9 1A E0 AE 5F CE 32 2E 7C 66 67 49 EC DD 6D 6A 38";

//#define SLACK_BOT_TOKEN "put-your-slack-token-here"
//#define WIFI_SSID       "wifi-name"
//#define WIFI_PASSWORD   "wifi-password"



long nextCmdId = 1;
bool connected = false;

unsigned long nextTimercheck;

// AC
#define IR_RX_PIN 14
#define IR_TX_PIN 2
#define AC_TYPE 1
#define AC_HEATING 0
#define AC_ON_MIN 5
#define AC_OFF_MIN 3

volatile struct
{
  uint8_t ac_mode;
  uint8_t ac_temp;
  uint8_t ac_flow;
  bool haveData;
  bool timermode;
  bool timerfirst;
  unsigned long intervalon;  // ms
  unsigned long intervaloff; // ms
  unsigned long timerMillis;
} ir_data;

IRrecv irrecv(IR_RX_PIN);
lgWhisen lgWhisen(AC_TYPE, AC_HEATING);

void chane_ac_temp_flow()
{
  if (ir_data.ac_mode == 1)
  {
    lgWhisen.setTemp(ir_data.ac_temp);
    lgWhisen.setFlow(ir_data.ac_flow);
    lgWhisen.activate();
  }
}

/**
  Sends a ping message to Slack. Call this function immediately after establishing
  the WebSocket connection, and then every 5 seconds to keep the connection alive.
*/
void sendPing()
{
  DynamicJsonBuffer jsonBuffer;
  JsonObject& root = jsonBuffer.createObject();
  root["type"] = "ping";
