Cannot establish MQTT Connection

Legolars
Posts: 3
Joined: Mon Aug 15, 2022 5:55 pm

Cannot establish MQTT Connection

Postby Legolars » Mon Aug 15, 2022 6:31 pm

Hello there folks,

i am currently trying to connect a ESP-WROOM-02D to a local MQTT Broker on my personal computer.
The wifi connection is successful, but I can not establish a MQTT Connection.


Here is a little snapshot of the messages I recieved via uart.

AT+RST<\r><\n>
<\r><\n>
OK<\r><\n>
WIFI DISCONNECT<\r><\n>
<\0><\0><\r><\n>
ready<\r><\n>
WIFI CONNECTED<\r><\n>
WIFI GOT IP<\r><\n>
AT+GMR<\r><\n>
AT version:2.2.1.0(46d6c26 - ESP8266 - Aug 6 2021 06:50:15)<\r><\n>
SDK version:v3.4-37-gd92d00e<\r><\n>
compile time(ede72af):Aug 6 2021 12:28:15<\r><\n>
Bin version:2.2.1(WROOM-02)<\r><\n>
<\r><\n>
OK<\r><\n>
AT+MQTTCONN=0,"192.168.188.20",1883,0<\r><\n>
<\r><\n>
ERROR<\r><\n>
<\0>


If I run the "AT+MQTTCONN?" command, I get the following response:
+MQTTCONN:0,0,0,"","","",0<\r><\n>
<\r><\n>
OK<\r><\n>



I also tried the Example 3 of the ESP-AT User Guide, but gt the same error.
I successfully used the following command for the Userconfig.
AT+MQTTUSERCFG=0,1,"ESP32","espressif","1234567890",0,0,"wss"

Could anybody please give me a hint or solution. Thank you very much!

Greetings
Lars

Legolars
Posts: 3
Joined: Mon Aug 15, 2022 5:55 pm

Re: Cannot establish MQTT Connection

Postby Legolars » Thu Aug 18, 2022 9:01 pm

Well, I think I might have made a rookie mistake by setting up the mqtt broker the wrong way. It did not allow other connections except localhost.
Well, I have not tried to connect via the SEP-WROOM Module, but I am pretty certain that was the mistake.

Sorry to have bothered you.

esp-at
Posts: 200
Joined: Mon May 09, 2022 3:00 am

Re: Cannot establish MQTT Connection

Postby esp-at » Fri Aug 19, 2022 5:35 am

Hi, which scheme do you config in your AT+MQTTUSERCFG command.
As the doc said here: https://docs.espressif.com/projects/esp ... figuration

<scheme>: MQTT over TLS is not supported due to memory limit on ESP8266, that is to say, this parameter can only be set to 1 or 6.

if you set <scheme> to 1, but still has the same issue. please enable debug log in menuconfig, and see the detailed logs in your AT log port.

Legolars
Posts: 3
Joined: Mon Aug 15, 2022 5:55 pm

Re: Cannot establish MQTT Connection

Postby Legolars » Fri Aug 19, 2022 8:57 am

Hi esp-at,
thank you for answering.
I did use the scheme 1 for MQTT over TCP in the userconfig.

But I did a rookie mistake of not allowing external devices connect to my broker. After fixing that, it was no problem for the esp to connect.
I successfully wrote following commands with their answere:

AT+MQTTUSERCFG=0,1,"ESP32","espressif","1234567890",0,0,"wss"<\r><\n>
<\r><\n>
OK<\r><\n>
AT+MQTTCONN=0,"192.168.188.20",1883,0<\r><\n>
+MQTTCONNECTED:0,1,"192.168.188.20","1883","",0<\r><\n>
<\r><\n>
OK<\r><\n>
AT+MQTTPUB=0,"topic","hallo",1,0<\r><\n>
<\r><\n>
OK<\r><\n>

esp-at
Posts: 200
Joined: Mon May 09, 2022 3:00 am

Re: Cannot establish MQTT Connection

Postby esp-at » Fri Aug 26, 2022 3:44 am

Good to know that, thanks for your explanation.

Who is online

Users browsing this forum: No registered users and 43 guests