Cloud Platform Integration Command Set
This chapter describes the Granwin IoT cloud platform integration command set. Adaptation varies by module; see Firmware Versions and Feature Differences for details.
AT+GWDEVICENAME: Set BLE provisioning device name
AT+GWCONFIGEN: Enable Granwin app provisioning mode
AT+GWCONNECTCONFIG: Set Granwin device credential parameters
AT+GWHTTPCLIENTLINE: Start certificate download
AT+GWAWSCONNECT: Enable connection
AT+GWAWSPUB: Publish data
AT+GWDEVICENAME: Configure BLE provisioning name and PID.
Execute Command
Command:
AT+GWDEVICENAME=<“蓝牙名称”>,<厂商PID>
Response:
OK
Parameters
<Bluetooth name>: String type; the device name shown during provisioning usually starts with “granwin”.
<Vendor PID>: Integer, 1–65535, usually provided by the Granwin cloud platform.
Notes
Set the BLE provisioning device name. Note: configure this before enabling provisioning mode.
Example
//设置BLE配网设备名称
AT+GWDEVICENAME="granwin_dev",137
OK
AT+GWCONFIGEN: Enable Granwin app provisioning mode.
Execute Command
Command:
AT+GWCONFIGEN
Response:
+EVENT:BLE_CONNECT
+EVENT:BLE_DISCONNECT
+EVENT:BLE_CONNECT
+EVENT:WIFI_CONNECT
+EVENT:WIFI_GOT_IP
+EVENT:BLE_DISCONNECT
OK
Notes
Enable Granwin app provisioning mode.
Example
//进入BLE配网模式
AT+GWCONFIGEN
+EVENT:BLE_CONNECT
+EVENT:BLE_DISCONNECT
+EVENT:BLE_CONNECT
+EVENT:WIFI_CONNECT
+EVENT:WIFI_GOT_IP
+EVENT:BLE_DISCONNECT
AT+GWCONNECTCONFIG: Set Granwin device credential parameters.
Execute Command
Command:
AT+GWCONNECTCONFIG=<“clientId”>,<"Secret“>,<“productKey”>
Response:
OK
Parameters
<client_id>: Client ID.
<secret>: Device secret.
<product_key>: Product key.
Notes
Set Granwin device credential parameters. Note: obtain these from the Granwin IoT cloud platform and configure them before downloading certificates and enabling connection.
Example
//设置配置连接参数
AT+GWCONNECTCONFIG="xxxxxxxxx","xxxxxxxxx","xxxxxxxxxxxx"
OK
AT+GWHTTPCLIENTLINE: Start certificate download.
Execute Command
Command:
AT+GWHTTPCLIENTLINE
Response:
+EVENT:GET TIME:1678693267532
+EVENT:GET TOKEN SUCCESS
+EVENT:GET PRIVATEKEY CART SUCCESS
+EVENT:GET DEVICE CART SUCCESSS
OK
Notes
Set Granwin device credential parameters. Note: obtain these from the Granwin IoT cloud platform and configure them before downloading certificates and enabling connection.
Example
//设置BLE配网设备名称
AT+SECRET=KZh1eMgxxxxxxxxxx,fdjfGHe1xxxxxx,EJK6xxxxxxxx
OK
AT+GWAWSCONNECT: Enable connection.
Execute Command
Command:
AT+GWAWSCONNECT=<enable>
Response:
OK
Parameters
- <enable>:
0: Disconnect
1: Connect
Notes
Enable connection. Note: certificates must be downloaded first. After connecting, the device automatically subscribes to the relevant topics.
Example
//启用连接
AT+GWAWSCONNECT=1
OK
AT+GWAWSPUB: Publish data.
Execute Command
Command:
AT+GWAWSPUB=<type>,<payload>,<qos>
Response:
OK
Parameters
- <type>:
0: topic: ${productKey}/${thingName}/user/update
1: topic: ${productKey}/${thingName}/user/property/query_response
2: topic: ${productKey}/${thingName}/user/ota/firmware/report
- <payload>:
JSON string
- <qos>:
0: qos0
1: qos1
2: qos2
Notes
Publish data. Note: the payload is the content under the data object in the Granwin IoT platform JSON protocol; escape special characters " as \"
Example
//发布数据
AT+GWAWSPUB=0,"{\"switch\":{\"type\":1,\"value\":1}}",0
OK