MQTT communication issues with Mongoose OS + ESP8266 + Firebase

Hey all,

I have been recently reading this forum, and I am amazed at how helpful this community is! Therefore, I am trying my luck with an issue we have right now.

My goal:

We are developing an IoT solution that includes, among other components an ESP8266, Google Cloud Platform (GCP), and a Firebase real-time database. Our aim is to control components such as motors, LEDs, etc. through the cloud, specifically, through Boolean values set in the Firebase database for certain components. The cloud and the ESP8266 communicate through the MQTT protocol. We use Mongoose OS for development.

My actions:

I have an issue that a certain component X sometimes does not show up in the Firebase database, whereas some others do. This component only receives data from the Firebase database, never sends any. We have already excluded the hardware and the C++ firmware code as the source of the issue leaving us with either Mongoose OS or the Google Cloud functions. The MQTT connection is made with the cloud, and some other components can send measurement data in the same system through telemetry. So the issue seems to be with component X that is to receive data from the Firebase database (e.gā€¦: Boolean value toggled).

The result I see:

Component X connected to the ESP8266 cannot receive the data from Firebase via MQTT.

My expectation & question is:

I expect the component X to be able to receive data from Firebase via MQTT as other components can send data through telemetry, and also, the MQTT connection is successfully made between the ESP8266 and the cloud.

I would appreciate your help, as this issue has turned pressing. If you need any more information, please do not hesitate to ask!

All the best,

Mark

1 Like

OKā€¦
Firebase = Google = not related to this
GCP I have some expertise and probably Iā€™m able to help.

Honestly I donā€™t understand what you are doing nor what ā€˜component Xā€™ is. You seem to have an ESP8266 connected to GCP. That connection is (a limited version of) MQTT and it is either up or down. You get configs and commands, you send telemetry and events. Please describe your problem and actions in that language. Whatever else you may have attached to the ESP8266 is not relevant.
Please describe what you do in terms of what is documented in the docs

If you are sending to the device, that can be commands or configs. Commands are sort of fire and pray, they may or may not get there, if you need to be certain you have to either develop your own scheme over that (see the RPC over GCP implementation for an example) or use configurations.
In your device, you will either see a command coming or a config change event. Do you ?
If commands donā€™t get there ā€œsometimesā€, it is Google stuff. Config changes should arrive if you donā€™t exceed the allowed rates of change. If they donā€™t you are either not doing your stuff properly within Google or your network connection is not OK.
You can subscribe to events on disconnects, you can observe the returned value by the isConnected() method, you can just send useless telemetry info to check it is arriving at PubSub (and so realize you are properly connectedā€¦).
And donā€™t expect realtime from Googleā€¦
If you get a message, are supposed to move a pin, and it doesnā€™t happen, then, you are not properly controlling your pinsā€¦

Mongoose-OS is a nice piece of software and works pretty well, I wouldnā€™t blame it on mOS so lightly (and I have no commercial relationship whatsoever with Cesanta, just several decades of making mistakes).

1 Like

Thank you very much for your reply! It was really helpful!