Mongoose Google IoT tutorial not working?

I am trying to integrate with Google IoT Core / Cloud by following this tutorial:
https://mongoose-os.com/docs/mongoose-os/cloud/google.md
Everything looks OK, I don’t get any error messages, except that none of the 2 examples work for me:

  1. Controlling LED via Google IoT Core: I sent the Config from the Google Console to the device, but the config does not appear in the monitor at all
  2. Reporting state to Google IoT Core: this also does not work, I don’t see any state objects under the device.

Additionally, not sure if it’s a related issue, but after the 6th state message, I get the following error in the log:

[Aug 26 00:48:08.839] /devices/esp8266_779E19/state -> {“total”:52672,“free”:36900}
[Aug 26 00:48:11.839] /devices/esp8266_779E19/state -> {“total”:52672,“free”:36780}
[Aug 26 00:48:14.834] /devices/esp8266_779E19/state -> {“total”:52672,“free”:36680}
[Aug 26 00:48:17.837] /devices/esp8266_779E19/state -> {“total”:52672,“free”:36584}
[Aug 26 00:48:20.836] /devices/esp8266_779E19/state -> {“total”:52672,“free”:36488}
[Aug 26 00:48:23.835] /devices/esp8266_779E19/state -> {“total”:52672,“free”:36392}
[Aug 26 00:48:23.846] mgos_mqtt_conn.c:574 MQTT0 queue overflow!
[Aug 26 00:48:26.835] /devices/esp8266_779E19/state -> {“total”:52672,“free”:36392}
[Aug 26 00:48:26.846] mgos_mqtt_conn.c:574 MQTT0 queue overflow!
[Aug 26 00:48:29.835] /devices/esp8266_779E19/state -> {“total”:52672,“free”:36392}
[Aug 26 00:48:29.846] mgos_mqtt_conn.c:574 MQTT0 queue overflow!

I tried to repeat the tutorial (after deling the device, registries, pub sub topics and the even the project ) 3-4x times already, so I am fairly certain that I did all as per instructions. :slight_smile: But for some reason, it does not work. :frowning: Any ideas?

Thanks!

I can assure you the tutorial works on 2.17.0 since I’ve run it last month on an ESP32.
Do you actually see your device connected in the Google console ?
Are you connected to your WiFi network ? If your MQTT queue is overflowing it is because messages can’t get out of your device.
Do you check isConnected() or register to suitable events ?

// send telemetry (events)
Timer.set(5000 /* milliseconds */, Timer.REPEAT, function() {
    if(GCP.isConnected()){
      let msg = JSON.stringify({free: Sys.free_ram(), total: Sys.total_ram()});
      print(topic, '->', msg);
      MQTT.pub(topic, msg, 1);
    }
}, null);

Event.GCP = Event.baseNumber('GCP');
Event.GCP_CONNECT = Event.GCP;
Event.GCP_CLOSE = Event.GCP + 3;

// handle connect/disconnect
Event.addHandler(Event.GCP_CONNECT, function (ev, evdata, ud) {
    Log.print(Log.INFO, 'Connected to GCP');
}, null);
Event.addHandler(Event.GCP_CLOSE, function (ev, evdata, ud) {
    Log.print(Log.INFO, 'Disconnected from GCP');
}, null);

// generic time change, includes SNTP (SYS+3)
Event.addHandler(Event.OTA_TIME_CHANGED, function (ev, evdata, ud) {
    Log.print(Log.INFO, 'Time set');
}, null);

You should get a time set log when connecting to Google’s SNTP server, then another when connecting to the platform, and then you will start sending.

Thanks a lot! Seems I missed to redo the wifi setup once I reflashed the firmware after a vanilla arduino flash. DOH! :slight_smile: Thanks a lot for you help, I appreciate it!