-->
Page 1 of 2

NodeMCU (ESP8266) is not able to connect to MQTT broker runn

PostPosted: Tue Jan 07, 2020 9:55 pm
by a.gaur89
I'm trying to connect NodeMCU with a local MQTT broker running on my raspi. The wifi access is provided by an access point (AP) created by same raspi. The nodemcu is able to connect to the access point but NOT able to connect to MQTT broker.

I know for sure that my local MQTT broker is working fine as one of the four nodemcu is able to connect to it successfully.

Also, I know for sure that my nodemcu is also working fine as the same device is working fine if the wifi access is provided by my home router and the MQTT broker is running on raspi.

BUT, if I'm using the raspi access point for wifi access and test.mosquitto.org as MQTT broker, then also the device is NOT able to connect to MQTT broker.

I don't know what is going wrong. Whether the problem is with access point or it's not possible to connect to MQTT broker running on the same raspi as the one who created the access point. I'm completely stuck. Any help is appreciated.

PS: All the nodemcu I tried had different client id.

Re: NodeMCU (ESP8266) is not able to connect to MQTT broker

PostPosted: Sat Jan 25, 2020 10:33 am
by survivingwithandroid
Hi,

maybe this tutorial might help you: https://www.survivingwithandroid.com/ra ... t-grafana/

It uses a MQTT broker running on Rasp pi and ESP8266 connects to it using MQTT.
You can check this tutorial too to know how to connect the ESP8266 to Raspberry Pi using MQTT:
https://www.survivingwithandroid.com/esp8266-mqtt-client-publish-subscribe/

Let me know if it can help you!

Re: NodeMCU (ESP8266) is not able to connect to MQTT broker

PostPosted: Mon Jan 27, 2020 7:06 am
by dionisis.bozikis
hello this is my first post here.
i am having the exact same problem.
i have created an local access point on a raspberry pi , i have 4 clients (nodemcu's) with the exact same code running in each and every one of them. all of them connect to the network, with different ip addresses, but only one of them can connect to the MQTT broker. also in my case as well, every one of the client, has a different clientID.

i am pretty much in the same position as a.gaur89.

need also help :mrgreen:

Re: NodeMCU (ESP8266) is not able to connect to MQTT broker

PostPosted: Mon Jan 27, 2020 7:40 pm
by davydnorris
Have you tried connecting to a broker running on a PC? Fire up something like mosquitto on your laptop and make sure the units can all connect to that first. That will eliminate any issue with the RasPi broker itself.