GoogleCloudPlatform/google-cloud-iot-arduino

Connection not stable.

josemtrg opened this issue · 2 comments

Im trying to implement the given example for a NodeMCU using this example:

https://github.com/GoogleCloudPlatform/google-cloud-iot-arduino/tree/master/examples/Esp8266-lwmqtt

Everything seems to work but the problem is that the connection is not stable. It connect and disconnects right after a few seconds. This is the logs i get:

///////////////////////////////
Connecting to WiFi
Waiting on time sync...
Connecting...
Refreshing JWT
connected

Library connected!
0
Connecting...
Refreshing JWT
connected

Library connected!
0
Connecting...
Refreshing JWT
connected
////////////////////////////////

It seems that the problem is on the mqtt loop function

  if (!mqtt->loop())
  {
    mqtt->mqttConnect();
  }

On Google Core IoT i get the following logs:

Screenshot 2020-11-09 at 11 28 56

When i try so send a command to the device i get an error message saying that the device is offline...

Did you make any changes to the example? If you use the MQTT protocol in a way the bridge does not expect, ex. publish to the wrong topic, the protocol bridge will disconnect you.

@gguuss Thanks. That was it. I was missing the "events" topic.