Example of cloud platform interconnection ================================= This document describes how to use the Combo AT command to interconnect with the Guangyun iot platform. .. contents:: :local: :depth: 1 .. 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 :doc:`../instruction/other/firmware_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: .. code-block:: none AT+GWDEVICENAME="granwin_dev",137 response .. code-block:: none OK 2. Enable network configuration. Only BLE network configuration is supported command: .. code-block:: none AT+GWCONFIGEN response .. code-block:: none +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: .. code-block:: none AT+GWCONNECTCONFIG="xxxxxxxxx","xxxxxxxxx","xxxxxxxxxxxx" response .. code-block:: none OK 2. Certificate request command: .. code-block:: none AT+GWHTTPCLIENTLINE response .. code-block:: none +EVENT:GET TIME:1678693267532 +EVENT:GET TOKEN SUCCESS +EVENT:GET PRIVATEKEY CART SUCCESS +EVENT:GET DEVICE CART SUCCESSS OK 3. Connect the platform and disconnect Connect platform command: .. code-block:: none AT+GWAWSCONNECT=1 response .. code-block:: none OK Disconnect command: .. code-block:: none AT+GWAWSCONNECT=0 response .. code-block:: none OK post message ------------------------------------------------------------------------ 1. post message Issue update command: .. code-block:: none AT+GWAWSPUB=0,"{\"switch\":{\"type\":1,\"value\":1}}",1 response .. code-block:: none OK Response query command: .. code-block:: none AT+GWAWSPUB=1,"{\"switch\":{\"type\":1,\"value\":1}}",1 response .. code-block:: none OK Publish the version number command: .. code-block:: none AT+GWAWSPUB=2,"1.0.1",1 response .. code-block:: none 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 .. code-block:: none +EVENT:/user/get,1,61,{"data":{"switch":{"type":1,"value":1}},"time":1678871216899} Complete instruction demonstration ------------------------------------------------------------------------ .. figure:: ../../_static/guangyun_AT_operation.gif :scale: 100 % :alt: guangyun_AT_operation