Skip to content

MQTT AT示例

MQTT连接oneNet云平台

本示例演示用MQTT推送数据到oneNet云平台,具体配置操作可见文档:MQTT上传数据至oneNet平台.pdf

1. 重启设备

命令:

AT+UCRESET

响应:

OK
+SYSTEM:START

2. 开机上电

命令:

AT+CFUN=1

响应:

OK

3. PDP激活

命令:

AT+CGACT=1,1

响应:

OK

4. 配置MQTT参数

命令:

AT+MQTTCONFIG="183.230.40.96",1883,"test01",1,60,"568564","version=2018-10-31&res=products%2F568564%2Fdevices%2Ftest01&et=1736222335&method=md5&sign=qrazy7durFvkwIsn3yCQVw%3D%3D"

响应:

OK

5. MQTT连接

命令:

AT+MQTTCONNECT

响应:

+MQTTCONNECT:0
OK

6. MQTT推送数据

命令:

AT+MQTTPUB="$sys/568564/test01/dp/post/json",1,0,"{\"id\":123,\"dp\":{\"latitude\":[{\"v\":108}],\"longitude\":[{\"v\":36}]}}"

响应:

OK

7. 断开连接

命令:

AT+MQTTDISCONNECT

响应:

OK

Back to top