 
   if (receivedtopic == homekit_subscribe_topic)
   {
-    if (root.containsKey("ac_temp"))
-    {
-      if (ir_data.ac_temp != root["ac_temp"])
+    if (root.containsKey("ac_temp") && root.containsKey("ac_mode") && root.containsKey("ac_flow"))
+    {
+      if ((ir_data.ac_temp != root["ac_temp"]) || (ir_data.ac_flow != root["ac_flow"]) || (ir_data.ac_mode != root["ac_mode"]))
       {
         ir_data.ac_temp = root["ac_temp"];
-
-        if (ir_data.ac_mode == 1)
-        {
-          ir_data.haveData = true;
-          where_haveData_called = 1;
-        }
+        ir_data.ac_flow = root["ac_flow"];
+        ir_data.ac_mode = root["ac_mode"];
+        ir_data.haveData = true;
+        where_haveData_called = 1;
       }
-      ir_data.ac_flow = root["ac_flow"];
-    }
-
-    if (root.containsKey("ac_mode"))
-    {
-      ir_data.ac_mode = root["ac_mode"];
-      ir_data.haveData = true;
-      where_haveData_called = 2;
     }
   }
 }

    free(p);
    client.loop();
    /*
    Serial.print("[MQTT] out topic : ");
    Serial.print(topictosend);
    Serial.print(" payload: ");
    Serial.print(payloadtosend);
    Serial.println(" publish failed");
    */
    return false;
  }

      else
      {
        /*
          Serial.print("[MQTT] mqtt failed, rc=");
          Serial.println(client.state());
        */
      }
    }
