Hello!
I have a problem with MQTT protocol. I use Raspberry Pi 5, ESP32 and Thonny. I have installed and uninstalled it several times now, changed passwords and conf file, nothing helps, still the message below:
Connection succeeded!
…
Failed to connect to MQTT broker. Reconnecting…
In the Raspberry Pi 5’s own terminal, mosquitto works correctly when I used the command
$ mosquitto_sub -h localhost -t test/topic -u user -P password
$ mosquitto_pub -h localhost -t test/topic -m “Hello World” -u user -P password
But mosquitto doesn’t work with ESP32, Thonny and sample code.
Hi.
What program exactly are you referring to?
I suggest copying the content of the boot.py file to the beginning of the main.py file.
Let me know if that changes anything.
Regards,
Sara
I just tested the example in 5.3 and it is working just fine as it is in the eBook.
Do you have any other devices connected to the broker?
Regards,
Sara
Thanks for answering! Unfortunately, English is not my native language, so it’s hard to explain, but I got the code working. The error was probably not in the code, but in the firewall of the Raspberry Pi. ChatGPT solved it this time. Everything will work out, some things just take longer.
Thank you! The book is very good! I have become a fan of IoT thanks to RND.