Comments on: ESP8266 and Node-RED with MQTT (Publish and Subscribe) https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Wed, 02 Jul 2025 10:51:42 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Sara Santos https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/#comment-1045489 Sun, 18 May 2025 12:02:45 +0000 http://randomnerdtutorials.com/?p=42183#comment-1045489 In reply to Pablo Banados.

Hi.
Did you install Node-RED dashboard via the interface, like in this tutorial: https://randomnerdtutorials.com/getting-started-node-red-dashboard/?

Regards,
Sara

]]>
By: Pablo Banados https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/#comment-1045436 Sun, 18 May 2025 03:49:38 +0000 http://randomnerdtutorials.com/?p=42183#comment-1045436 Hi,
Really fascinating!….
Totally new in this, although I managed to get Mosquitto up and running in a MacOS and edited its config file to accept anonymous users (seems to be needed in version 2.0.21), as well as node-red (and connected it to mosquitto), but…. I can’t get dashboards working in node-red in the same machine with macOS (Node-red v4-0-9, node.js v23.11.0).
I sucessfully installed node-red’s dashboard extension with “npm install node-red-dashboard” in the Terminal; the files are in fact installed in the folder of node-red, but dashboard functions still don’t appear in the node-red session at the browser. What I’m doing wrong?
Another one: With Mosquitto running in the background as a service in the computer, how do you see/tune what’s going on in the server?

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/#comment-976535 Sun, 27 Oct 2024 22:31:32 +0000 http://randomnerdtutorials.com/?p=42183#comment-976535 In reply to Steve Gale.

You’re passing the server variable which refers to the web server instead of the MQTT client.

const char* mqtt_server = “192.168.4.183”;
PubSubClient client(server); –> this is wrong

Regards,
Sara

]]>
By: Steve Gale https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/#comment-976530 Sun, 27 Oct 2024 22:06:50 +0000 http://randomnerdtutorials.com/?p=42183#comment-976530 In reply to paolo.

Did you get this to work?

I have just started to do the same thing,, I am currently reading a temperature sensor , publishing the data to a web server so I can also do OTA updates.
Next step is to send a MQTT message.
but the following
// Create AsyncWebServer object on port 80
AsyncWebServer server(80);

// try and create mqtt client
const char* mqtt_server = “192.168.4.183”;
PubSubClient client(server);

generates an error
no matching function for call to ‘PubSubClient::PubSubClient(AsyncWebServer&)’

I have had a quick look at the PubSubClient documentation and the only example it gives is for a WifiClient.

If you managed to sort this it would save me having to do some further investigation.

Cheers
Steve

]]>
By: Thiwanka Hewavitharana https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/#comment-852837 Wed, 02 Aug 2023 17:53:58 +0000 http://randomnerdtutorials.com/?p=42183#comment-852837 Serial monitor does not show the outputs inside the callback funtions such as “Message arrived on topic:”. That means callback function is not invoked.what could be the reasons for that.My all connection are correct.

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/#comment-844268 Sat, 01 Jul 2023 09:11:39 +0000 http://randomnerdtutorials.com/?p=42183#comment-844268 In reply to Petra.

Hi.
You cannot use localhost to refer to the broker in your ESP8266 code.
You need to use the broker IP address, in this case, it will be your computer IP address on your local network.
Regards,
Sara

]]>
By: Petra https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/#comment-844254 Sat, 01 Jul 2023 07:38:52 +0000 http://randomnerdtutorials.com/?p=42183#comment-844254 Hi,
thank you very much for this great and detailed tutorial. Could you please help with my question? I have mqtt broker running on my windows laptop not on a raspberry. Everything works fine: Esp is connected to the broker on localhost. The Node red is set up as you described it and is connected too. But there are no messages arriving. Is there something to change in my windows installation?
Thank you very much,
best regards, Petra

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/#comment-843725 Thu, 29 Jun 2023 17:20:36 +0000 http://randomnerdtutorials.com/?p=42183#comment-843725 In reply to Ronni Fletcher.

Hi.
No, you don’t need an ESP8266 or ESP32.
You can also connect peripherals directly to the Raspberry Pi without the need of other microcontroler.
Unfortunately, we don’t have any tutorials with the microbit.
Does it have Wi-Fi? If so, there’s probably a sample code for MQTT with microbit.
If not, you’ll need to send the data via RX/TX, but unfortunately, we don’t have any tutorials about the microbit.
Regards,
Sara

]]>
By: Ronni Fletcher https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/#comment-843488 Wed, 28 Jun 2023 15:05:21 +0000 http://randomnerdtutorials.com/?p=42183#comment-843488 Firstly – Thanks for this guys. I have to admit I didn’t read the majority of the comments so please excuse if there is an answer above. Can this project be done with just 1 raspberry pi running node red and mosquito (so without the esp8266 – the sensor readings are usb serial ported into the pi from weatherbit on microbit) or 2 raspberry pis or one pi and the node red and mosquito on my Linus machine I have for home assistant? Does it always have to have an esp board? I have the spare esp boards but for the life of my I can’t figure out how to get the microbit data (they export radio/Bluetooth and serial rx/TX and usb serial) into the esp or then parse the data to then make sense of it. I keep finding half tutorials from forever ago randomly on the Web and nothing is working for me. I managed to get the serial data into node red from pi but I can’t figure out the function call process. It’s proving to be the most complex weather station in the world…. You’d think I was sampling Mars 😀 if there is a particular book or course that covers this, please let me know. I’m pulling my hair out atm.

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-and-node-red-with-mqtt/#comment-826329 Tue, 21 Mar 2023 15:49:07 +0000 http://randomnerdtutorials.com/?p=42183#comment-826329 In reply to Alwi.

Hi.
Check with hiveMQT how you need to pass the MQTT URL.
You also need to insert the MQTT username and password. I just updated the tutorial with a new code that now uses MQTT username and password. Make sure you insert those.
Regards,
Sara

]]>