|
Try the below script in the AT Command Tester tool
//Script: at+smstate //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+SMSTATE=? //Wait WAIT=1 //Get the MQTT connection status AT+SMSTATE? //Wait WAIT=1 //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 //Get the MQTT connection status AT+SMSTATE?
Output of the above script in the AT Command Tester tool
AT+SMSTATE=? +SMSTATE: (0-1) OK AT+SMSTATE? +SMSTATE: 0 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+SMSTATE? +SMSTATE: 1 OK