Hello. I am following one of your tutorials on your blog called, “MicroPython – Getting Started with MQTT on ESP32/ESP8266. I uploaded the code for the first ESP32/ESP8266 and it is connecting to the WiFi network but I can’t connect to the MQTT raspberry pi broker. I double-checked the IP address with the ‘hostname -I” command and reuploaded the code a few times but it still isn’t working. Is there a way to fix this?
Thanks in advance.
How did you install the Mosquitto broker?
Did you set permissions so that it is able to accept connections from outside the Raspberry Pi?
Thank you. I didn’t know that you had to install permissions. I just used these commands
pi@raspberry:~ $ sudo apt update pi@raspberry:~ $ sudo apt install -y mosquitto mosquitto-clients
pi@raspberry:~ $ sudo systemctl enable mosquitto.service
pi@raspberry:~ $ hostname -I
What is the command to access permissions
Check this tutorial: https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/
Scroll down to the section “Enable Remote Access/ Authentication”. Then, follow one of those two options.
Note that if you enable the option with username and password, then you need to pass the username and password on the code you upload to your board.
I hope this helps.
I helps but I am getting a lot of junk.
I don’t get the success message but when I subscribed to hello using the OS console, it says that it is receiving the message. I will count that as a success.
Thanks for you help
What junk are you referring to?
Can you be a little more specific?