Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lesson36- remote control relay by KC868-A8S 4G module via MQTT AT command
#1
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: 
.zip   mqtt-relay.zip (Size: 1.35 KB / Downloads: 271)

.pdf   SIM7500_SIM7600 Series_MQTT_ATC_V1.01.pdf (Size: 740.41 KB / Downloads: 299)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)