Creating a Google Cloud IoT Core MQTT Gateway Device?

  1. My goal is:

To create a Google Cloud IoT Core MQTT Gateway which will be used to send sensor data from multiple devices to a PubSub topic and ultimately a Firebase Realtime Database.

I am developing this project using multiple ESP32. I am trying to utilize 2x ESP32 for the sensor devices and 1x ESP32 for the gateway device. All are using Mongoose OS JS-enabled firmware from

I am stuck trying to create the Gateway device for this project. I have successfully created non-gateway devices that can publish to the PubSub topic, but have been having a difficult time with the gateway.

  1. My actions are:

I have used this mos command to create the non-gateway devices:

mos gcp-iot-setup --gcp-project YOUR_PROJECT_ID --gcp-region europe-west1 --gcp-registry iot-registry

This command is described in Mongoose OS Documentation, but I am having a hard time finding documentation about creating a gateway with a similar command.

I know how to create a Gateway device using the Google Cloud IoT Core console and gcloud commands, but when it comes to making my particular Mongoose OS device a gateway I am lost.

  1. The result I see is:

This approach only creates non-gateway devices.

  1. My expectation & question is:

Is there a way to create a gateway using similar “mos gcp-iot-setup…” commands? Is there another approach I can use? Currently a CS student so my apologies if this is trivial.

Google Cloud IoT Core documentation explains how to create a gateway, but I’m not really sure how to incorporate this with my ESP32 with Mongoose OS. It seems like it is possible to create a script to do this, but I don’t know how to run a script on my device with MongooseOS on it.

Lastly, there is an approach that uses a RaspberryPi instead of the ESP32, perhaps that will be necessary…

AFAIK, a Google IoT Core Gateway is a Google invented hipothetic device with certain specifications that a developer will turn into a reality by following the specs and possibly some example code.
AFAIK, no one has done that for mOS, so there is no magic command to create one.
Step 1: understand the specs. Your first link has example code for C# Go Java Node.js Python Ruby. None of that can run on mOS. Probably some Node.js can help to be turned into mJS (or some Python might run on microPython but that is not mOS). Your second link points to Python code. Same comment.
Step 2: transform that into mOS code, either C or mJS or both