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:

  1. 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",137

response

OK
  1. Enable network configuration. Only BLE network configuration is supported

command:

AT+GWCONFIGEN

response

+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.

  1. Configuring connection parameters

command:

AT+GWCONNECTCONFIG="xxxxxxxxx","xxxxxxxxx","xxxxxxxxxxxx"

response

OK
  1. Certificate request

command:

AT+GWHTTPCLIENTLINE

response

+EVENT:GET TIME:1678693267532
+EVENT:GET TOKEN SUCCESS
+EVENT:GET PRIVATEKEY CART SUCCESS
+EVENT:GET DEVICE CART SUCCESSS

OK
  1. Connect the platform and disconnect

Connect platform command:

AT+GWAWSCONNECT=1

response

OK

Disconnect command:

AT+GWAWSCONNECT=0

response

OK

post message

  1. post message

Issue update command:

AT+GWAWSPUB=0,"{\"switch\":{\"type\":1,\"value\":1}}",1

response

OK

Response query command:

AT+GWAWSPUB=1,"{\"switch\":{\"type\":1,\"value\":1}}",1

response

OK

Publish the version number command:

AT+GWAWSPUB=2,"1.0.1",1

response

OK

receive data

  1. 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

guangyun_AT_operation