Example of cloud platform interconnection¶
This document describes how to use the Combo AT command to interconnect with the Guangyun iot platform.
Important
This example has different adaptations for different modules. For specific differences, please go to the following steps to check the support status of the module instruction Firmware iterations and differences。
Important
Before use, it is necessary to register the device on Guangyun iot platform and obtain ‘secret’ + ‘client_id’ + ‘product_key’, which is set by instructions before the device obtains the token and certificate.
Guangyun APP WIFI distribution network¶
BLE distribution network:
Configure the Bluetooth name and PID of the distribution network. The APP is filtered by name by default, and the name must contain the granwin field
command:
AT+GWDEVICENAME="granwin_dev",137response
OK
Enable network configuration. Only BLE network configuration is supported
command:
AT+GWCONFIGENresponse
+EVENT:BLE_CONNECT +EVENT:BLE_DISCONNECT +EVENT:BLE_CONNECT +EVENT:WIFI_CONNECT +EVENT:WIFI_GOT_IP +EVENT:BLE_DISCONNECT OK
Connected platform correlation¶
Important
The straight line connecting cloud platform needs to create products on GuangyunTianjian platform in advance, and “productKey” can be obtained during creation. For other connection parameters, “clientID”, “Secret” and “Manufacturer PID” can be obtained only after providing authorized parameters to GuangyunTianjian staff.
Configuring connection parameters
command:
AT+GWCONNECTCONFIG="xxxxxxxxx","xxxxxxxxx","xxxxxxxxxxxx"response
OK
Certificate request
command:
AT+GWHTTPCLIENTLINEresponse
+EVENT:GET TIME:1678693267532 +EVENT:GET TOKEN SUCCESS +EVENT:GET PRIVATEKEY CART SUCCESS +EVENT:GET DEVICE CART SUCCESSS OK
Connect the platform and disconnect
Connect platform command:
AT+GWAWSCONNECT=1response
OK
Disconnect command:
AT+GWAWSCONNECT=0response
OK
post message¶
post message
Issue update command:
AT+GWAWSPUB=0,"{\"switch\":{\"type\":1,\"value\":1}}",1response
OKResponse query command:
AT+GWAWSPUB=1,"{\"switch\":{\"type\":1,\"value\":1}}",1response
OK
Publish the version number command:
AT+GWAWSPUB=2,"1.0.1",1response
OK
receive data¶
After the connection is completed, the user automatically subscribes to and related topics, and the data delivered by the platform will be returned directly.
response
+EVENT:/user/get,1,61,{"data":{"switch":{"type":1,"value":1}},"time":1678871216899}
Complete instruction demonstration¶