Lesson36- remote control relay by KC868-A8S 4G module via MQTT AT command - Printable Version +- Smart Home Automation Forum (https://www.kincony.com/forum) +-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=1) +--- Forum: KC868-A series and Uair Smart Controller (https://www.kincony.com/forum/forumdisplay.php?fid=6) +--- Thread: Lesson36- remote control relay by KC868-A8S 4G module via MQTT AT command (/showthread.php?tid=2002) |
Lesson36- remote control relay by KC868-A8S 4G module via MQTT AT command - admin - 06-26-2022 MQTT AT command debug for KC868-A8S: publish message to MQTT broker: 1. AT+CMQTTSTART 2. AT+CMQTTACCQ=0,"KinCony1" 3. AT+CMQTTCONNECT=0,"tcp://iot.kincony.com:1883",120,1,"mqtt","123" 4. AT+CMQTTTOPIC=0,18 5. > relay8/12345/state 6. AT+CMQTTPAYLOAD=0,19 7. > {"relay1":{"on":1}} 8. AT+CMQTTPUB=0,1,60 this is puslish a message for update MQTT broker relay state when relay1 is ON subscribe topic from MQTT broker: AT+CMQTTSUB=0,16,1,1 relay8/12345/set will receive example message: +CMQTTRXSTART: 0,16,3 +CMQTTRXTOPIC: 0,16 relay8/12345/set +CMQTTRXPAYLOAD: 0,3 abc +CMQTTRXEND: 0 this is demo for receive message: abc +CMQTTRXSTART: 0,16,19 +CMQTTRXTOPIC: 0,16 relay8/12345/set +CMQTTRXPAYLOAD: 0,19 {"relay1":{"on":0}} +CMQTTRXEND: 0 this is demo for receive message: {"relay1":{"on":0}} here is arduino IDE source code: mqtt-relay.zip (Size: 1.35 KB / Downloads: 349) SIM7500_SIM7600 Series_MQTT_ATC_V1.01.pdf (Size: 740.41 KB / Downloads: 388) |