|
Try the below script in the AT Command Tester tool
//Script: at+smunsub //The AT commands in this script are applicable for Simcom modules only //Check SIMCOM Module AT Command documentaiton //Get the support for AT+SMPUB command AT+SMUNSUB=? //Activate the application network AT+CNACT=0,1 //Wait WAIT=1 //Set up the MQTT URL AT+SMCONF="URL","test.mosquitto.org","1883" //Wait WAIT=1 //Set up the MQTT time to connect server AT+SMCONF="KEEPTIME",60 //Wait WAIT=1 //Connect to the MQTT server AT+SMCONN //Wait WAIT=4 //Subcribe to a topic on the MQTT server AT+SMSUB="my_topic",1 //Wait WAIT=1 //Activate the application network AT+SMUNSUB="my_topic"
Output of the above script in the AT Command Tester tool
AT+SMUNSUB=? +SMUNSUB: 128 OK AT+CNACT=0,1 OK +APP PDP: 0,ACTIVE AT+SMCONF="URL","test.mosquitto.org","1883" OK AT+SMCONF="KEEPTIME",60 OK AT+SMCONN OK AT+SMSUB="my_topic",1 OK AT+SMUNSUB="my_topic" OK