                 onDisconnected();
             }
             lastAliveCheck = millis();            
-            Serial.println("startAlive(" + String(esp8266alive) + ")");
-            Serial.flush();
-            Serial.println("connectAP(\"" + String(APssid) + "\", \"" + String(APpsw) + "\")");
-            Serial.flush();
+            esp8266Serial.println("startAlive(" + String(esp8266alive) + ")");
+            esp8266Serial.flush();
+            esp8266Serial.println("connectAP(\"" + String(APssid) + "\", \"" + String(APpsw) + "\")");
+            esp8266Serial.flush();
         } else if (cb[0] == 'a') {
             lastAliveCheck = millis();
             checkComm();
         } else if (cb[0] == 'w') {
             //wifi connected
-            Serial.println("mqttInit(\"" + String(MQTTid) + "\", \"" + String(MQTTip) + "\", " + MQTTport + ", \"" + String(MQTTuser)
+            esp8266Serial.println("mqttInit(\"" + String(MQTTid) + "\", \"" + String(MQTTip) + "\", " + MQTTport + ", \"" + String(MQTTuser)
                             + "\", \"" + String(MQTTpsw) + "\", " + MQTTalive + ", " + MQTTretry + ")");
-            Serial.flush();
+            esp8266Serial.flush();
         } else if (cb[0] == 'c') {
             //mqtt connected
             connected = true;

        lastAliveCheck = millis();
        connected = false;        
    }
    if (Serial.find("[(")) {
        Serial.readBytes(cb, 1);
        if (cb[0] == 'r') {
            //ready
            if (connected) {

void onMessage(String topic, String message) {
  if (topic == String(MQTTid) + "/Led/c") {
    setLed(message);
  } else if (topic == String(MQTTid) + "/Allarme/c") {
    if (message == "1" && !alarmOn) {
      abilitaAllarme(true);
