Cloud Platform Integration Examples

This document describes integrating with the Guangyun IoT platform using Combo-AT commands.

Important

Command Flow

guangyun_AT_process

Guangyun App Wi-Fi Provisioning

BLE Provisioning:

  1. Configure the Bluetooth name and PID for provisioning. The app filters by name by default; the name must contain the granwin field.

Command:

AT+GWDEVICENAME="granwin_dev",137

Response

OK
  1. Start provisioning (BLE provisioning only)

Command:

AT+GWCONFIGEN

Response

+EVENT:BLE_CONNECT

+EVENT:BLE_DISCONNECT

+EVENT:BLE_CONNECT

+EVENT:WIFI_CONNECT

+EVENT:WIFI_GOT_IP

+EVENT:BLE_DISCONNECT

OK

Platform Connection

Important

  • 连接云平台直线需要提前在广云天匠平台创建产品,创建时可获取 “productKey”,其他连接参数,需要向广云天匠工作人员提供授权参数后,才能获得“clientID”、“Secret”和”厂商PID”。

  1. Configure 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 to and disconnect from the platform

Connect to platform command:

AT+GWAWSCONNECT=1

Response

OK

Disconnect command:

AT+GWAWSCONNECT=0

Response

OK

Publish messages

  1. Publish messages

Publish update command:

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

Response

OK

Publish query response command:

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

Response

OK

Publish version number command:

AT+GWAWSPUB=2,"1.0.1",1

Response

OK

Receive data

  1. After connecting, relevant topics are subscribed automatically; data from the platform is returned directly.

Response

+EVENT:/user/get,1,61,{"data":{"switch":{"type":1,"value":1}},"time":1678871216899}

Complete Command Demo

guangyun_AT_operation