The shape of a typical minimalist one line MQTT post - SteveCossy/IOT GitHub Wiki

Andrew's email

Can we simply  post MQTT packets into wifi direct from an 08M2 ! If you give me the shape of a typical minimalist one line MQTT post then I can test this idea out. Here below is skeleton code / outline.... This I realise is a very shaky one sided and there is no handshaking error / status checking and I imagine accessing Cayenne MQTT has layers of User + PW + CliID to barn storm before an 08M2 can plaster data onto a dashboard ?

Nearest we currently have to this is in the code CayenneMQTT/cayMQTT_to_csv.py That code uses the paho.mqtt.client Python libraries, as opposed to cayenne.client which uses Cayenne specific libraries to do the same thing.

Andrew's skeleton code / outline....

++++++++++++++++++++++++++++++++ Power_ON:                        'Allow module to start and dump welcome messages wait 5

AT_OK: serout 4,T9600_8,("AT",13,10)            'OK = All Good wait 5

'ATE:                            'Echo OFF  (cleared by power or AT_RST) 'serout 4,T9600_8,("ATE1",13,10)        'ATE0=Disable echo ATE1=Enable echo 'wait 5

AT_CWMODE:                                '1=Sta,2=AP,3=both,Sta default mode of router serout 4,T9600_8,("AT+CWMODE=3",13,10)    'AP normal mode for devices mode wait 5

AT_CWLAP:                        'Let's see if we can see your wireless router serout 4,T9600_8,("AT+CWLAP",13,10) wait 10

AT_CWJAP:                        'Let's see if we can join the party serout 4,T9600_8,("AT+CWJAP=",34,"dd-wrt",34,44,34,34,13,10) wait 10

AT_CIFSR:                        'Your module's IP address should be displayed. serout 4,T9600_8,("AT+CIFSR",13,10) wait 5

AT_CIPSTART:    'AT+CIPSTART="TCP","203.118.129.73",80 LF CR serout 4,T9600_8,("AT+CIPSTART=",34,"TCP",34,44,34,"203.118.129.73",34,44,"80",13,10) wait 5

AT_CIPSEND_Lat_Lon: serout 4,T9600_8,("AT+CIPSEND=94",13,10) wait 5

POST_Lat_Lon:            'POST the message to S 39.45126 E 173.85381 on google map serout 4,T9600_8,("POST /api/marker?key=xyz&node=01&channel=B&latitude=-39.451260&longitude=173.853881&data=6\r\n",13,10) wait 5

AT_CIPCLOSE:    'Close connection serout 4,T9600_8,("AT+CIPCLOSE",13,10) wait 5

References

ESP8266 Product Specification

ESP8266 AT Command Examples