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

Nicrus86
Posts: 1
Joined: Thu Oct 08, 2020 9:44 am

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

Postby Nicrus86 » Thu Oct 08, 2020 5:13 pm

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/fi ... .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

Code: Select all

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

OK
--------------------------
[2] Connection configuration

Code: Select all

AT+MQTTCONNCFG=0,60,0,"lwt_topic","lwt_message",1,0

OK
--------------------------
[3] Connect to the platform

Code: Select all

AT+MQTTCONN=0,"thingsboard.iotprojects.eu",9082,0


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

OK
--------------------------
[4] Check connection

Code: Select all

AT+MQTTCONN?
+MQTTCONN:0,4,1,"thingsboard.iotprojects.eu","9082","",0

OK
--------------------------
[5] Subscribe to topic

Code: Select all

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 ... mands.html)
===== [1] User configuration =====
- 1° parameter ==> <LinkID>: 0
- 2° parameter ==> <scheme>: 1 (MQTT over TCP)
- 3° parameter ==> <"client_id">: "ESP32_module" (chosen arbitrarily) it's optional?
- 4° parameter ==> <"username">: <"ACCESS TOKEN of IoT device">
- 5° parameter ==> <"password">: ""
- 6° parameter ==> <cert_key_ID>: 0
- 7° parameter ==> <CA_ID>: 0
- 8° parameter ==> <"path">: ""
===== [2] Connection configuration =====
- 1° parameter ==> <LinkID>: 0
- 2° parameter ==> <keepalive>: 60
- 3° parameter ==> <disable_clean_session>: 0
- 4° parameter ==> <lwt_topic>: "lwt_topic" (is it unique option??)
- 5° parameter ==> <lwt_message>: "lwt_message" (is it unique option??)
- 6° parameter ==> <lwt_qos>: 1
- 7° parameter ==> <lwt_retain>: 0
===== [3] Connect to the platform =====
- 1° parameter ==> <LinkID>: 0
- 2° parameter ==> <"host">: "thingsboard.iotprojects.eu"
- 3° parameter ==> <port>: 9082
- 4° parameter ==> <reconnect>: 0
===== [5] Subscribe to topic =====
- 1° parameter ==> <LinkID>: 0
- 2° parameter ==> <"topic">: "v1/devices/me/telemetry"
- 3° parameter ==> <qos>: 1 (because it is the first topic)


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.

ESP-Marius
Posts: 74
Joined: Wed Oct 23, 2019 1:49 am

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

Postby ESP-Marius » Fri Oct 09, 2020 11:01 am

This might be related to the (wrong) header IDs Thingboard uses for e.g. suback. It's a known issue, see https://github.com/espressif/esp-mqtt/issues/134

Who is online

Users browsing this forum: No registered users and 97 guests