Meaning of +QMTCONN:0,1

Hello all,

I was struggling with getting “MQTT is initial” state of 1 in response to AT+QMTCONN?. I didn’t know what it meant and how to resolve it. After much debugging here’s what I’ve found.

This error occurs when you try to check for a connection i.e. QMTCONN? after sending a QMTOPEN command but before the response of getting the successful connection. The below two sequences of command will better explain.


Situation 1: Successful connection

AT+QMTOPEN=0,“12…url…243”,1883
OK

+QMTOPEN: 0,0

AT+QMTOPEN?
+QMTOPEN: 0,“12…url…243”,1883

AT+QMTCONN?
+QMTCONN:0,3


Situation 2: Unsuccessful connection

AT+QMTOPEN=0,“12…url…243”,1883
OK

AT+QMTOPEN?
+QMTOPEN: 0,“12…url…243”,1883

AT+QMTCONN?
+QMTCONN:0,1


So this issue occured because the response time of AT+QMTOPEN=0,“12…url…243”,1883 with +QMTOPEN: 0,0 can be many tens of seconds. And strangely if AT+QMTOPEN? gives a successful opened response when queried in this time. So with +QMTCONN:0,1 response we can see that the opening is not yet successful.

Hope this helps anyone who has faced similar issue.

Hi prithvi
AT+QMTOPEN? result not gives the status of the MQTT OPEN state, it gives you the information of tcp connect ID, host name and Port name.

while after write the AT+QMTOPEN command you have to wait the complete response i.e. till the URC +QMTOPEN: ,, where result gives you the correct actual state of the MQTT open state after that only you have to send the next command.


if the MQTT connection close automatically you will get the URC +QMTSTAT

Quectel_GSM_MQTT_Application_Note_V1.2.pdf (518.0 KB)

attached application note for your reference.

Regards
Rahul

Ok, thanks Rahul. So there we have to wait for the URC? Is there any way to check the status of the open state otherwise?

Once broker is open successfully with the +QMTOPEN urc using AT+QMTOPEN=,“host_name”, you can check with the AT+QMTOPEN? command.

1 Like