Need some advice on the correct formatting please as I am not quite there.
Using a SIM7600 and trying to connect to HiveMQ port 8883 and set the topic will and msg.
Write Command
AT+CMQTTWILLTOPIC=<client_index>,<req_length>
Expected output
AT+CMQTTWILLTOPIC=0,17
>temp/temperature
OK
Example

My code below. If I use IDE serial or TeraTerm I can use the following commands successfully
AT+CSSLCFG="sslversion",0,4
AT+CSSLCFG="authmode",0,2
AT+CSSLCFG="cacert",0,"isrgrootx1.pem"
AT+CMQTTSTART
AT+CMQTTACCQ=0,"client1",1
AT+CMQTTSSLCFG=0,0
AT+CMQTTSTART
AT+CMQTTACCQ=0,"client1",1
AT+CMQTTSSLCFG=0,0
AT+CMQTTWILLTOPIC=0,17
test/temperature/
AT+CMQTTWILLMSG=0,2,1
29
I see my issue to be the code AT+CMQTTWILLTOPIC the waiting for the prompy of > then sending the willtopic of test/temperature/ my logs at the bottom of this post dont look quite correct.
e.g., AT+CMQTTWILLTOPIC=1,17\r", 1000, "\r\n> rather than AT+CMQTTWILLTOPIC=0,17\r\n where it waits for the prompt >
// modem.sendAT("+CMQTTWILLTOPIC=0,17,\"temp/temperature\"");
// if (!modem.waitResponse(1000)) {
// Serial.println("CMQTTWILLTOPIC command failed with /");
// return false;
// }
modem.sendAT("+CMQTTWILLTOPIC=0,17\r\n");
modem.waitResponse(1000);
Serial.println("temp/temperature\r\n");
modem.waitResponse(1000);
if (!modem.waitResponse(1000)) {
Serial.println("CMQTTWILLTOPIC command failed");
return false;
}
// Send AT+CMQTTWILLMSG=0,25 temp/temperature then 29
modem.sendAT("+CMQTTWILLMSG=0,2,1,\"17\"");
if (!modem.waitResponse(1000)) {
Serial.println("CMQTTWILLMSG command failed");
return false;
}
delay(1000);
Log output with this code
18:36:39.526 -> AT+IPADDR
18:36:39.526 ->
18:36:39.526 -> +IPADDR: xxx.xxx.xxx.xxx
18:36:39.574 ->
18:36:39.574 -> OK
18:36:39.621 -> Connecting to xxx.s1.eu.hivemq.cloud
18:36:39.621 ->
18:36:39.621 -> AT+CNSMOD?
18:36:39.621 ->
18:36:39.621 -> +CNSMOD: 0,8
18:36:39.621 ->
18:36:39.668 -> OK
18:36:39.668 -> AT+CSSLCFG="sslversion",0,4
18:36:39.668 ->
18:36:39.668 -> OK
18:36:39.668 -> AT+CSSLCFG="authmode",0,1
18:36:39.668 ->
18:36:39.715 -> OK
18:36:39.715 -> AT+CCERTLIST
18:36:39.715 ->
18:36:39.715 -> +CCERTLIST: "isrgrootx1.pem"
18:36:39.761 ->
18:36:39.808 -> OK
18:36:39.808 -> AT+CSSLCFG="cacert",0,"isrgrootx1.pem"
18:36:39.808 ->
18:36:39.808 -> OK
18:36:39.808 -> AT+CMQTTREL=0
18:36:39.853 ->
18:36:39.853 -> OK
18:36:39.853 -> AT+CMQTTSTOP
18:36:39.853 ->
18:36:39.853 -> +CMQTTSTOP: 0
18:36:39.901 ->
18:36:39.901 -> OK
18:36:39.901 -> AT+CMQTTSTART
18:36:39.949 ->
18:36:39.949 -> +CMQTTSTART: 0
18:36:39.949 ->
18:36:39.949 -> OK
18:36:39.995 -> AT+CMQTTACCQ=0,"Client1",1,4
18:36:39.995 ->
18:36:39.995 -> OK
18:36:39.995 -> AT+CMQTTSSLCFG=0,0
18:36:39.995 ->
18:36:40.041 -> OK
18:36:40.041 -> AT+CMQTTWILLTOPIC=0,25
18:36:40.041 ->
18:36:40.041 ->
18:36:40.041 -> >temp/temperature
18:36:41.033 ->
18:36:42.015 -> AT+CMQTTWILLMSG=0,2,1,"29"
18:36:42.062 ->
18:36:42.062 -> OK
18:36:43.037 -> AT+CMQTTCONNECT=0,"tcp://xxx.s1.eu.hivemq.cloud:8883",60,1,"xxx","xxx"
18:36:44.063 -> MQTT Connect success
18:36:44.063 -> AT+NETOPEN?
18:36:44.063 ->
18:36:44.110 -> +CMQTTCONNECT: 0,12
Write command is AT+CMQTTCONNECT AT+CMQTTCONNECT=<client_index>,<server_addr>,<keepalive_time>,<clean_session>[,<user_name>[,<pass_word>]
Return should be +CMQTTCONNECT: 0,0 not +CMQTTCONNECT: 0,12 which is 'invalid format'