I keep getting a "Attempting MQTT connection...failed, rc=-2 trying again in 2 seconds" error message printed on the serial monitor. The python codes seem to be running fine on the RPi but I don't seem to be able to establish a connection between the ESP32 to the broker.
@@fakturmuhfroni3616 @Laplace777 Not sure if helps but I had the same issue, I fixed it by adding the following two lines in the mosquitto config file listener 1883 allow_anonymous true Config file is located in /etc/mosquitto/mosquitto.conf
Someone can help me? I get the error: "Unsupported callback API version: version 2.0 added a callback_api_version" when I I am running the python Script. What can I do?
Thanks for your tutorial but I faced some difficulties while applying the scripts. I always have "ConnectionRefusedError: [Errno 111] connection refused" when I I am running the python Script. I am using the raspberry as Broker and client and I ve tried both to publish and Subscribe to a topic as defined in the script but with out any positive result. I ve checked the IP-adress but I dont think thats the problem.
Hi Jitesh helloworld, what a great project! It works properly. I would like to setup a MQTT project with one ESP32 as a subscriber and another ESP32 as publisher. The broker should be a local RasPi standalone as Broker-Server creating its own WLAN without connection to the Internet via Router or Access Point. Can you give me hints how to do this? The handling of the ESP32 should be easy. But with the RasPi I have got my problems to combine the installed Mosquitto and the WLAN-Server capabilities. Do you have this setup described in one of your courses? (Please without NodeRed.) Thanks! Oli
Raspberry Pi as a client is already covered in the project. The client_sub.py and client_pub.py are the python scripts that can run on any other Raspberry Pi also. In this project the broker and client scripts are present on the same device. You can run them on different RPis also. For more information read this article helloworld.co.in/article/mqtt-raspberry-pi-esp32
Hi. I'm currently working on a project. In my case i need to get several sensor values using several nodeMCU modules. Then i need to send those values to the broker and the broker will make some calculations on those values. Then i need to publish the result to all Node MCU modules for taking actions. Can you guide me?. Is it possible?. Can i pass data in client_sub to client_pub?.
Yes. You can do that.. Pl understand, here the broker only relays the messages between devices. It doesn't do any modification in the data. You need to make one of the client (preferably RPi) to collect the data from all nodeMCUs on a topic and then do you calulations and publish the results on a topic which every other device is subscribed to.
@@jitesh_helloworld Thanks for the quick response and for the advice. In my case do I need to have 2 raspberrypi modules?(one as broker one as client) or one is enough(run 2 separate scripts in same rpi). Is there any reference I can follow. Again thank you! You are a life saviour! 👍✌❤
Yes you can use the a single RPi for this. It can run a broker as well as client python scripts. In this video I configured the RPi in similar manner. helloworld.co.in/article/mqtt-raspberry-pi-esp32 Link to source codes is given in article as well as video description
In your project, client_pub didn't subscribe to any topics. In my case i need to subscribe to all topics. Is it possible then. I thought the publisher couldn't subscribe to other topics. Thanks for the reply. ❤️
It can publish and subscribe at the same time. So that's a simple assignment which you can figure out.. Notice that ESP 32 program does both Publish and subscribe in a same program. So in RPi it is much easier to achieve that with python.
To the point. Very welldone. I have one stupid question. 1. Can we implement MQTT client & broker with esp01 with AT commands firmware?If yes how? if no why? Thanks
Thanks. I haven't used AT commands with esp. But I'm sure that with limited resources of a microcontroller implementing broker functionality would be challenging
one more question see if you can answer. 1. I want to communicate 2xESP01 through mqtt in which one will be broker and another will be client and all this will happen over WLAN. Allowing us to perform mqtt operations without internet. Is it possible? How should i do it? @@jitesh_helloworld
simple, direct and clear. Thanks brother
Excellent teaching and software you've! Please upload more videos to make us more Powerful as you're.
Thanks. Sure👍
Keep going !! You such a priest to me. Thanks for publishing. I'm subscribing now for sure !!
Hahahaha
I keep getting a "Attempting MQTT connection...failed, rc=-2 trying again in 2 seconds" error message printed on the serial monitor. The python codes seem to be running fine on the RPi but I don't seem to be able to establish a connection between the ESP32 to the broker.
same
@@fakturmuhfroni3616 @Laplace777 Not sure if helps but I had the same issue, I fixed it by adding the following two lines in the mosquitto config file
listener 1883
allow_anonymous true
Config file is located in /etc/mosquitto/mosquitto.conf
@@SebulbaBG thank's boy now I have "Attempting MQTT connection...connected" 🤝
is there a way to do this without the router? there is no router-wifi where the project will be. it is outdoors.
Someone can help me?
I get the error: "Unsupported callback API version: version 2.0 added a callback_api_version" when I I am running the python Script.
What can I do?
pip install paho-mqtt==1.5.1
it will work
Thanks for your tutorial but I faced some difficulties while applying the scripts.
I always have "ConnectionRefusedError: [Errno 111] connection refused" when I I am running the python Script. I am using the raspberry as Broker and client and I ve tried both to publish and Subscribe to a topic as defined in the script but with out any positive result.
I ve checked the IP-adress but I dont think thats the problem.
Great! Thank you for share
Thanks
Hi Jitesh helloworld,
what a great project! It works properly.
I would like to setup a MQTT project with one ESP32 as a subscriber and another ESP32 as publisher. The broker should be a local RasPi standalone as Broker-Server creating its own WLAN without connection to the Internet via Router or Access Point.
Can you give me hints how to do this?
The handling of the ESP32 should be easy. But with the RasPi I have got my problems to combine the installed Mosquitto and the WLAN-Server capabilities.
Do you have this setup described in one of your courses? (Please without NodeRed.)
Thanks!
Oli
You explain very well but you haven't try Raspberry Pi as a Client. Do you have code or tutorial to use Raspberry Pi as a client?
Raspberry Pi as a client is already covered in the project. The client_sub.py and client_pub.py are the python scripts that can run on any other Raspberry Pi also. In this project the broker and client scripts are present on the same device. You can run them on different RPis also. For more information read this article
helloworld.co.in/article/mqtt-raspberry-pi-esp32
Great **Jitesh**👍
Thanks :)
will it work if they are connected to different wifi routers in different locations?
Yes, anywhere in the world.
Hi, does the esp need to be connected on same network as the brocker connected to?
No, can be any broker, anywhere.
hi i have a question if i run the program for 2 esp32 's i constantly says disconected coneccted
Pl ensure that you have given different names to the clients while initialising at line 72 of the ESP code.
Hi. I'm currently working on a project. In my case i need to get several sensor values using several nodeMCU modules. Then i need to send those values to the broker and the broker will make some calculations on those values. Then i need to publish the result to all Node MCU modules for taking actions. Can you guide me?. Is it possible?. Can i pass data in client_sub to client_pub?.
Yes. You can do that.. Pl understand, here the broker only relays the messages between devices. It doesn't do any modification in the data. You need to make one of the client (preferably RPi) to collect the data from all nodeMCUs on a topic and then do you calulations and publish the results on a topic which every other device is subscribed to.
@@jitesh_helloworld Thanks for the quick response and for the advice. In my case do I need to have 2 raspberrypi modules?(one as broker one as client) or one is enough(run 2 separate scripts in same rpi). Is there any reference I can follow. Again thank you! You are a life saviour! 👍✌❤
Yes you can use the a single RPi for this. It can run a broker as well as client python scripts. In this video I configured the RPi in similar manner.
helloworld.co.in/article/mqtt-raspberry-pi-esp32
Link to source codes is given in article as well as video description
In your project, client_pub didn't subscribe to any topics. In my case i need to subscribe to all topics. Is it possible then. I thought the publisher couldn't subscribe to other topics. Thanks for the reply. ❤️
It can publish and subscribe at the same time. So that's a simple assignment which you can figure out.. Notice that ESP 32 program does both Publish and subscribe in a same program. So in RPi it is much easier to achieve that with python.
To the point. Very welldone.
I have one stupid question.
1. Can we implement MQTT client & broker with esp01 with AT commands firmware?If yes how? if no why?
Thanks
Thanks.
I haven't used AT commands with esp. But I'm sure that with limited resources of a microcontroller implementing broker functionality would be challenging
Thanks
may i get your email to talk to you for any work@@jitesh_helloworld
one more question see if you can answer.
1. I want to communicate 2xESP01 through mqtt in which one will be broker and another will be client and all this will happen over WLAN. Allowing us to perform mqtt operations without internet. Is it possible? How should i do it? @@jitesh_helloworld
Do you provide the code?
Yes check the description, it has link to article and GitHub
For me its constantly showing connected disconnected and trying to connect. Can anyone suggest how to solve this issue. Nice video. Keep going
Ensure that you have different names while initialising the clients
@@jitesh_helloworld thanks
It got resolved when I tried with different machine
@@jitesh_helloworld now while flashing with the esp32 modules it's showing esp not declared . Can you suggest what to do . I am new electronic