     bpresence = false;
   }
 
-  if (!bpresence && ir_data.ac_presence_mode == 1)
+  if (!bpresence && (ir_data.ac_presence_mode == 1))
   {
     Serial.println("[IR] -----> AC Power Down");
     lgWhisen.power_down();


#include "/usr/local/src/aptls_setting.h"

const char* subscribe_cmd   = "esp8266/cmd/ac";
const char* subscribe_set   = "esp8266/cmd/acset";
const char* reporting_topic = "report/pirtest";
const char* homekit_reporting_topic = "homekit/bedroom/aircon/get";
const char* homekit_subscribe_topic = "homekit/bedroom/aircon/set";
const char* hellotopic              = "HELLO";

  JsonObject& root = jsonBuffer.createObject();
  root["ac_mode"]           = ir_data.ac_mode;
  root["ac_temp"]           = ir_data.ac_temp;
  root["ac_flow"]           = ir_data.ac_flow;  
  root["cur_temp"]          = temperature * 0.01;
  root["cur_humi"]          = humidity;
  root["presence"]          = uint8_t(bpresence);
