1.深度复位:
深度复位: AT+RESTORE
2.STA模式:
2、STA模式: AT+CWMODE=1
3.连接路由器:
连接路由器: AT+CWJAP="wifi名称","wifi密码"
4.配置MQTT用户属性: (连接ThingsBoard时密码为空)
配置MQTT用户属性: AT+MQTTUSERCFG=0,1,"clientID","ThingBoard设备访问令牌","",0,0,""
5.连接指定 MQTT broker:
连接指定 MQTT broker: AT+MQTTCONN=0,"服务器IP",ThingsBoard端口号,0
6.查询MQTT连接状态:
查询MQTT连接状态: AT+MQTTCONN?
7.订阅来自ThingsBoard的topic数据:
订阅ThingsBoard数据: AT+MQTTSUB=0,"v1/devices/me/rpc/request/+",1
8.向ThingsBoard平台发布数据: (注意多个属性的值之间逗号一定加\)
8、发布一个属性的值:
AT+MQTTPUB=0,"v1/devices/me/telemetry","{\"temperature\":25}",1,0
发布多个属性的值:
AT+MQTTPUB=0,"v1/devices/me/telemetry","{\"temperature\":81.00\,\"humidity\":43.00}",1,0