MQTT communication issues with Mongoose OS + ESP8266 + Firebase

#1

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
#2

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
#3

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