Hi Rui I Have a problem during learning ESP8266-12E and Mqtt I use one of your code (https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/) and change SSID, password and RPi IP address but always get this error
Attempting MQTT connection…failed, rc=-2 try again in 5 seconds
Attempting MQTT connection…failed, rc=-2 try again in 5 seconds
Attempting MQTT connection…failed, rc=-2 try again in 5 seconds
Attempting MQTT connection…failed, rc=-2 try again in 5 seconds
Hi.
That means that your ESP8266 is not able to connect to your broker.
Do you have your Raspberry Pi running the broker?
You can test the broker connection with this tutorial: https://randomnerdtutorials.com/testing-mosquitto-broker-and-client-on-raspbbery-pi/
Regards,
Sara
Great!
I’ll mark this question as resolved.
If you need further help, you just need to open a new question in our forum.
Regards,
Sara