• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Attempting MQTT connection…failed,

Q&A Forum › Category: ESP8266 › Attempting MQTT connection…failed,
0 Vote Up Vote Down
Mohammed Azeez asked 3 years ago

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

Question Tags: Raspberry Pi+esp8266-12E
6 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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
 

0 Vote Up Vote Down
Mohammed Azeez answered 3 years ago

Hi Sara,
thanks for your Replay
it wok     thank you very much    you save me:)

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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

0 Vote Up Vote Down
Mohammed Azeez answered 3 years ago

yes  thank you very much for your help

0 Vote Up Vote Down
Ramitha Goonewardena answered 1 year ago

Hi Rui,
I really enjoy your book on building an automation system under $100, but currently stuck with the MQTT broker failing to connect to my esp8266.  Attempting MQTT connection…failed, rc=-2 try again in 5 seconds.  I have double-checked the IP address,node-red settings for setting up the MQTT broker, and any changes that need to be made to the mosquitto config file. Does the raspberry pi os come with a firewall ?, I also have the raspberry pi Model B. Your help would be appreciated

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Follow your question here: https://rntlab.com/question/esp8266-not-connecting-with-mqtt-broker-raspberry-pi/

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2023 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.