espressif / esp-at

AT application for ESP32/ESP32-C2/ESP32-C3/ESP32-C6/ESP8266
Apache License 2.0
875 stars 782 forks source link

[ESP32 DevKit C v4] [AT command] [MQTT] [Thingsboard] - Disconnected/Error at command AT+MQTTSUB #478

Closed Nicrus86 closed 3 years ago

Nicrus86 commented 3 years ago

I use the board 'ESP32 NodeMCU DevKit C v4' and I flashed it using the following firmware 'ESP32-WROOM-32_AT_Bin_V2.1.0.0' (http://download.espressif.com/esp_at/firmware/ESP32/ESP32_WROOM/ESP32-WROOM-32_AT_Bin_V2.1.0.0.zip ). I use a Beaglebone Enhanced to run AT commands throught serial port UART1. I have an issues with the AT commands for MQTT connection; in particular when I try to subscribe to a topic of my IoT platform Thingsboard. In the following there is the sequence of MQTT commands used.

[1] User configuration AT+MQTTUSERCFG=0,1,"ESP32_module",<"ACCESS TOKEN of IoT device">,"",0,0,""

OK

[2] Connection configuration AT+MQTTCONNCFG=0,60,0,"lwt_topic","lwt_message",1,0

OK

[3] Connect to the platform AT+MQTTCONN=0,"thingsboard.iotprojects.eu",9082,0

+MQTTCONNECTED:0,1,"thingsboard.iotprojects.eu","9082","",0

OK

[4] Check connection AT+MQTTCONN? +MQTTCONN:0,4,1,"thingsboard.iotprojects.eu","9082","",0

OK

[5] Subscribe to topic AT+MQTTSUB=0,"v1/devices/me/telemetry",1 +MQTTDISCONNECTED:0

ERROR

The assumptions that I have done are: (following the guide ==> https://docs.espressif.com/projects/esp-at/en/latest/AT_Command_Set/MQTT_AT_Commands.html) ===== [1] User configuration =====

I need to understand if my configuration is wrong and/or if some parameters of AT commands above indicates is wrong. If there is anyone who has already worked with the AT commands of the ESP32, please share me some examples to understand better how work it.

ustccw commented 3 years ago

@Nicrus86 please take a look about some AT+MQTT examples:

You can capture the packets to analysis why the MQTT Subscribe failed