Im having a issue with MQTT. Im currently using a third-party sim, and manual mode (rarely connect to particles cloud). Basically this is my loop
if (Cellular.ready())
{
digitalWrite(ledGPRS,0);
attempts = 0;
if (mqttClient.isConnected()) {
mqttClient.loop();
} else {
Serial.println("Connect to the MQTT server!!");
mqttClient.connect(clientId,username,password);
if (mqttClient.isConnected()) {
Serial.println("Connected");
mqttClient.addQosCallback(qoscallback);
mqttClient.publish("reconnections", celu.imei);
}
}
}
else
{
digitalWrite(ledGPRS,1);
if(attempts > 10){
System.reset();
}
if ((millis() - lastConnect) >= CONNECT_TIMEOUT)
{
if(bomba_encendida == APAGADO) // Si la bomab esta desconectada
{
Cellular.disconnect();
Cellular.off();
delay(5000);
debug < 1 ? debug=0:Serial.println("Intento conectar modem celular.");
Cellular.on();
Cellular.connect();
lastConnect = millis();
attempts++;
}
}
}
Sometimes it connects, but if reset it, when trying again , won’t connect again
I was able to get the log from CloudMqtt, and basically the connection request is done, however i think de conACK never arrives, so the connection is never established. Any idea? Thanks
1502718718: New connection from 179.29.45.169 on port 18509.
1502718726: New connection from 179.29.45.169 on port 18509.
1502718734: New connection from 179.29.45.169 on port 18509.
1502718747: New connection from 179.29.45.169 on port 18509.
1502718754: New connection from 179.29.45.169 on port 18509.
1502718762: New connection from 179.29.45.169 on port 18509.
1502718770: New connection from 179.29.45.169 on port 18509.
1502718778: New connection from 179.29.45.169 on port 18509.
1502718786: New connection from 179.29.45.169 on port 18509.
1502718793: New connection from 179.29.45.169 on port 18509.
1502718801: New connection from 179.29.45.169 on port 18509.
1502718809: New connection from 179.29.45.169 on port 18509.
1502718817: New connection from 179.29.45.169 on port 18509.
1502718825: New connection from 179.29.45.169 on port 18509.
1502718858: New connection from 179.29.45.169 on port 18509.
1502718991: New connection from 179.29.45.169 on port 18509.
1502719150: New connection from 179.29.45.169 on port 18509.