From 3dd843b8ead0f3ba453879100b143155b6d1f736 Mon Sep 17 00:00:00 2001 From: Sun Lu Xin Date: Fri, 30 Aug 2024 20:25:48 +0800 Subject: [PATCH] docs: add network_provisioning_examples --- docs/en/AT_Command_Examples/index.rst | 1 + .../network_provisioning_examples.rst | 499 ++++++++++++++++++ docs/zh_CN/AT_Command_Examples/index.rst | 1 + .../network_provisioning_examples.rst | 499 ++++++++++++++++++ 4 files changed, 1000 insertions(+) create mode 100644 docs/en/AT_Command_Examples/network_provisioning_examples.rst create mode 100644 docs/zh_CN/AT_Command_Examples/network_provisioning_examples.rst diff --git a/docs/en/AT_Command_Examples/index.rst b/docs/en/AT_Command_Examples/index.rst index a6db6793..a8599298 100644 --- a/docs/en/AT_Command_Examples/index.rst +++ b/docs/en/AT_Command_Examples/index.rst @@ -17,6 +17,7 @@ AT Command Examples HTTP AT Examples :esp32: Classic Bluetooth AT Examples Sleep AT Examples + AT Network Provisioning Examples .. only:: esp32c3 diff --git a/docs/en/AT_Command_Examples/network_provisioning_examples.rst b/docs/en/AT_Command_Examples/network_provisioning_examples.rst new file mode 100644 index 00000000..a66ef26c --- /dev/null +++ b/docs/en/AT_Command_Examples/network_provisioning_examples.rst @@ -0,0 +1,499 @@ +.. include:: ../../inline_substitutions + +AT Network Provisioning Examples +================================= + +:link_to_translation:`zh_CN:[中文]` + +This document mainly introduces the following network provisioning methods supported by ESP-AT: + +.. list:: + + :not esp32s2: * :ref:`BluFi Provisioning ` + * :ref:`SmartConfig Provisioning ` + * :ref:`SoftAP Provisioning (WEB Provisioning) ` + * :ref:`WPS Provisioning ` + +.. only:: esp32 or esp32c3 or esp32c6 + + .. list-table:: Summary of Key Parameters for Provisioning Methods + :header-rows: 1 + :widths: 45 35 35 35 35 + + * - Provisioning Method + - BluFi Provisioning + - SmartConfig Provisioning + - SoftAP Provisioning + - WPS Provisioning + * - Default Firmware Support + - |icon-green-check| + - |icon-green-check| + - |icon-red-cross| (:ref:`Note 1 `) + - |icon-green-check| + * - Requires BLE + - |icon-green-check| + - |icon-red-cross| + - |icon-red-cross| + - |icon-red-cross| + * - Requires Additional Mobile App + - |icon-green-check| + - |icon-green-check| (:ref:`Note 2 `) + - |icon-green-check| + - |icon-red-cross| + * - Provisioning Success Rate + - High + - Moderate + - High + - High + * - Operation Complexity + - Simple + - Simple + - Complex + - Complex + * - Recommendation Level + - Recommended + - Moderate + - Moderate + - Moderate + +.. only:: esp32c2 + + .. list-table:: Summary of Key Parameters for Provisioning Methods + :header-rows: 1 + :widths: 45 35 35 35 35 + + * - Provisioning Method + - BluFi Provisioning + - SmartConfig Provisioning + - SoftAP Provisioning + - WPS Provisioning + * - Default Firmware Support + - |icon-green-check| (:ref:`Note 3 `) + - |icon-green-check| + - |icon-red-cross| (:ref:`Note 1 `) + - |icon-green-check| + * - Requires BLE + - |icon-green-check| + - |icon-red-cross| + - |icon-red-cross| + - |icon-red-cross| + * - Requires Additional Mobile App + - |icon-green-check| + - |icon-green-check| (:ref:`Note 2 `) + - |icon-green-check| + - |icon-red-cross| + * - Provisioning Success Rate + - High + - Moderate + - High + - High + * - Operation Complexity + - Simple + - Simple + - Complex + - Complex + * - Recommendation Level + - Recommended + - Moderate + - Moderate + - Moderate + +.. only:: esp32s2 + + .. list-table:: Summary of Key Parameters for Provisioning Methods + :header-rows: 1 + :widths: 45 35 35 35 + + * - Provisioning Method + - SmartConfig Provisioning + - SoftAP Provisioning + - WPS Provisioning + * - Default Firmware Support + - |icon-green-check| + - |icon-red-cross| (:ref:`Note 1 `) + - |icon-green-check| + * - Requires BLE + - |icon-red-cross| + - |icon-red-cross| + - |icon-red-cross| + * - Requires Additional Mobile App + - |icon-green-check| (:ref:`Note 2 `) + - |icon-green-check| + - |icon-red-cross| + * - Provisioning Success Rate + - Moderate + - High + - High + * - Operation Complexity + - Simple + - Complex + - Complex + * - Recommendation Level + - Recommended + - Moderate + - Moderate + +.. _np-note: + + - Note 1: If you want to enable SoftAP provisioning in the AT firmware, please refer to: :doc:`../AT_Command_Set/Web_server_AT_Commands`. + - Note 2: The AirKiss provisioning in SmartConfig requires the WeChat app, which may be unavailable to users outside China. + + .. only:: esp32c2 + + - Note 3: The default ESP32C2-4MB AT firmware supports BluFi functionality, while the ESP32C2-2MB AT firmware does not. For more details, please refer to :ref:`Bluetooth LE AT Command Introduction `. + +.. only:: not esp32s2 + + .. _example-at_blufi: + + BluFi Provisioning + ------------------- + + BluFi is a Wi-Fi configuration feature based on the Bluetooth channel. For more information, please refer to the `BluFi documentation `_. + + #. Install the EspBluFi app on your mobile device. + + - Android: `Download EspBluFi for Android `_ (`Android Source Code `_) + - iOS: `Download EspBluFi for iOS `_ (`iOS Source Code `_) + + #. Set the BluFi name on the {IDF_TARGET_NAME} device. + + Command: + + .. code-block:: none + + AT+BLUFINAME="blufi_test" + + Response: + + .. code-block:: none + + OK + + #. Enable BluFi on the {IDF_TARGET_NAME} device. + + Command: + + .. code-block:: none + + AT+BLUFI=1 + + Response: + + .. code-block:: none + + OK + + #. Establish BluFi connection on your mobile device and perform Wi-Fi provisioning. + + 4.1 BluFi Connection + + Enable the system's Bluetooth and GPS location services on your mobile device, then launch the EspBluFi app. Find the device named ``blufi_test`` and click it to enter. Next, click ``Connect`` to establish a connection. At this point, the ESP device should log something similar to ``+BLUFICONN``, and the app will display the below information, indicating that the BluFi connection has been successfully established. + + .. code-block:: none + + Connected + + Discover service and characteristics success + + Set notification enable complete + + Set mtu complete, mtu=... + + 4.2 BluFi Wi-Fi Provisioning + + After the connection is established, click ``Configure`` button in the EspBluFi app. The page will navigate to ``Configure`` page. Enter the Wi-Fi SSID and password, then click ``OK`` button to start provisioning. After a short wait, the app will display the below information. + + .. code-block:: none + + Post configure params complete + + Receive device status response: + OpMode: Station + Station connect Wi-Fi now + Station connect Wi-Fi bssid: + Station connect Wi-Fi ssid: + + 4.3 Successful Provisioning + + Please wait for a moment, and the ESP device will output the following logs. At this point, the ESP device's network configuration is successfully completed. + + .. code-block:: none + + WIFI CONNECTED + WIFI GOT IP + + #. (Optional) Send custom user data via BluFi on the {IDF_TARGET_NAME} device. + + Command: + + .. code-block:: none + + AT+BLUFISEND=4 + + Response: + + .. code-block:: none + + > + + Input 4 bytes of data, for example, if the input data is ``test``, then AT will output the following information. + + .. code-block:: none + + OK + + At this point, the app will display the below information: + + .. code-block:: none + + Receive custom data: + test + + #. Disable BluFi on the {IDF_TARGET_NAME} device. + + Command: + + .. code-block:: none + + AT+BLUFI=0 + + Response: + + .. code-block:: none + + +BLUFIDISCONN + + OK + + At this point, the app will display the below information: + + .. code-block:: none + + Disconnect , status=19 + +.. _example-at_smartconfig: + +SmartConfig Provisioning +------------------------ + +AT SmartConfig provisioning offers four types: ESP-TOUCH, AirKiss, ESP-TOUCH+AirKiss, and ESP-TOUCH v2. Below are examples of ESP-TOUCH v2 provisioning. + +ESP-TOUCH v2 Provisioning Example +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +#. Install the EspTouch app on your mobile device. + + - Android: `Download EspTouch for Android `_ (`Source Code for Android `_) + - iOS: `Download EspTouch for iOS `_ (`Source Code for iOS `_) + +#. Set the ESP device to Station mode. + + Command: + + .. code-block:: none + + AT+CWMODE=1 + + Response: + + .. code-block:: none + + OK + +#. Enable SmartConfig on the {IDF_TARGET_NAME} device. + + Command: + + .. code-block:: none + + AT+CWSTARTSMART=4,0,"1234567890123456" + + Response: + + .. code-block:: none + + OK + +#. Perform Wi-Fi provisioning on your mobile device. + + Please follow the steps below: enable Wi-Fi on your mobile device and connect to the target network (e.g., SSID: test, password: 1234567890). Then, launch the EspTouch application and click ``EspTouch V2`` button. On the redirected page, enter the password for the connected Wi-Fi, the number of devices for provisioning, and the AES key, as shown below: + + .. code-block:: none + + Wi-Fi Password: 1234567890 + Device Count for Provisioning: 1 + AES Key: 1234567890123456 + +#. Confirm the successful provisioning on the ESP device. + + At this point, the ESP device should output the below information: + + .. code-block:: none + + smartconfig type:ESPTOUCH_V2 + Smart get wifi info + ssid:test + password:1234567890 + WIFI CONNECTED + WIFI GOT IP + smartconfig connected wifi + + At this point, the ESP device's provisioning has been successfully completed. + +#. Disable SmartConfig on the {IDF_TARGET_NAME} device. + + Command: + + .. code-block:: none + + AT+CWSTOPSMART + + Response: + + .. code-block:: none + + OK + +.. AirKiss Provisioning Example +.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. +.. #. Open the WeChat application on your mobile device, search for and follow the "Espressif Technology" official account. +.. +.. #. Set the ESP device to Station mode. +.. +.. Command: +.. +.. .. code-block:: none +.. +.. AT+CWMODE=1 +.. +.. Response: +.. +.. .. code-block:: none +.. +.. OK +.. +.. #. Enable SmartConfig on the {IDF_TARGET_NAME} device. +.. +.. Command: +.. +.. .. code-block:: none +.. +.. AT+CWSTARTSMART=2 +.. +.. Response: +.. +.. .. code-block:: none +.. +.. OK +.. +.. #. Perform Wi-Fi provisioning on your mobile device. +.. +.. Connect your mobile device to the Wi-Fi network that requires provisioning (e.g., SSID: test, password: 1234567890), then open WeChat, and go to the "Espressif Systems" official account. Click ``Product Resources``, find the AirKiss device, and enter its page. On the redirected page, enter the Wi-Fi password ``1234567890``. After a moment, the mobile will display the log message ``Configuration successful......``. +.. +.. At this point, the ESP device should output the below information: +.. +.. .. code-block:: none +.. +.. smartconfig type:AIRKISS +.. Smart get wifi info +.. ssid:test +.. password:1234567890 +.. WIFI CONNECTED +.. WIFI GOT IP +.. smartconfig connected wifi +.. +.. At this point, the ESP device's provisioning has been successfully completed. +.. +.. #. Disable SmartConfig on the {IDF_TARGET_NAME} device. +.. +.. Command: +.. +.. .. code-block:: none +.. +.. AT+CWSTOPSMART +.. +.. Response: +.. +.. .. code-block:: none +.. +.. OK + +.. _example-at_softap: + +SoftAP Provisioning +-------------------- + +AT SoftAP provisioning refers to WEB provisioning. For more details, please refer to :doc:`Web Server AT Examples <../AT_Command_Examples/Web_server_AT_Examples>`. + +.. _example-at_wps: + +WPS Provisioning +-------------------- + +#. Prepare a router that supports WPS provisioning (e.g., Wi-Fi SSID: test). + +#. Set the ESP device to Station mode. + + Command: + + .. code-block:: none + + AT+CWMODE=1 + + Response: + + .. code-block:: none + + OK + +#. Enable WPS provisioning on the {IDF_TARGET_NAME} device. + + Command: + + .. code-block:: none + + AT+WPS=1 + + Response: + + .. code-block:: none + + OK + + Enable the WPS provisioning according to the router's user manual, and wait for a moment. The ESP device should output the below information, indicating that the provisioning has been successfully completed. + + .. code-block:: none + + WIFI CONNECTED + WIFI GOT IP + +#. Query the Wi-Fi information of the connected {IDF_TARGET_NAME} device. + + Command: + + .. code-block:: none + + AT+CWJAP? + + Response: + + .. code-block:: none + + +CWJAP:"test",...... + OK + +#. Disable WPS provisioning on the {IDF_TARGET_NAME} device. + + Command: + + .. code-block:: none + + AT+WPS=0 + + Response: + + .. code-block:: none + + OK diff --git a/docs/zh_CN/AT_Command_Examples/index.rst b/docs/zh_CN/AT_Command_Examples/index.rst index 7ec70f98..e11560ec 100644 --- a/docs/zh_CN/AT_Command_Examples/index.rst +++ b/docs/zh_CN/AT_Command_Examples/index.rst @@ -17,6 +17,7 @@ AT 命令示例 HTTP AT 示例 :esp32: Classic Bluetooth AT 示例 Sleep AT 示例 + AT 配网示例 .. only:: esp32c3 diff --git a/docs/zh_CN/AT_Command_Examples/network_provisioning_examples.rst b/docs/zh_CN/AT_Command_Examples/network_provisioning_examples.rst new file mode 100644 index 00000000..5da56e17 --- /dev/null +++ b/docs/zh_CN/AT_Command_Examples/network_provisioning_examples.rst @@ -0,0 +1,499 @@ +.. include:: ../../inline_substitutions + +AT 配网示例 +================================= + +:link_to_translation:`en:[English]` + +本文档主要介绍以下几种 ESP-AT 支持的配网方式: + +.. list:: + + :not esp32s2: * :ref:`BluFi 配网 ` + * :ref:`SmartConfig 配网 ` + * :ref:`SoftAP 配网(WEB 配网) ` + * :ref:`WPS 配网 ` + +.. only:: esp32 or esp32c3 or esp32c6 + + .. list-table:: 配网方式关键参数总结 + :header-rows: 1 + :widths: 45 35 35 35 35 + + * - 配网方式 + - BluFi 配网 + - SmartConfig 配网 + - SoftAP 配网 + - WPS 配网 + * - 默认固件支持情况 + - |icon-green-check| + - |icon-green-check| + - |icon-red-cross| (:ref:`备注 1 `) + - |icon-green-check| + * - 是否需要 BLE + - |icon-green-check| + - |icon-red-cross| + - |icon-red-cross| + - |icon-red-cross| + * - 是否需要额外的手机 APP + - |icon-green-check| + - |icon-green-check| (:ref:`备注 2 `) + - |icon-green-check| + - |icon-red-cross| + * - 配网成功率 + - 高 + - 较高 + - 高 + - 高 + * - 操作复杂性 + - 简单 + - 简单 + - 复杂 + - 复杂 + * - 推荐指数 + - 推荐 + - 中等 + - 中等 + - 中等 + +.. only:: esp32c2 + + .. list-table:: 配网方式关键参数总结 + :header-rows: 1 + :widths: 45 35 35 35 35 + + * - 配网方式 + - BluFi 配网 + - SmartConfig 配网 + - SoftAP 配网 + - WPS 配网 + * - 默认固件支持情况 + - |icon-green-check| (:ref:`备注 3 `) + - |icon-green-check| + - |icon-red-cross| (:ref:`备注 1 `) + - |icon-green-check| + * - 是否需要 BLE + - |icon-green-check| + - |icon-red-cross| + - |icon-red-cross| + - |icon-red-cross| + * - 是否需要额外的手机 APP + - |icon-green-check| + - |icon-green-check| (:ref:`备注 2 `) + - |icon-green-check| + - |icon-red-cross| + * - 配网成功率 + - 高 + - 较高 + - 高 + - 高 + * - 操作复杂性 + - 简单 + - 简单 + - 复杂 + - 复杂 + * - 推荐指数 + - 推荐 + - 中等 + - 中等 + - 中等 + +.. only:: esp32s2 + + .. list-table:: 配网方式关键参数总结 + :header-rows: 1 + :widths: 45 35 35 35 + + * - 配网方式 + - SmartConfig 配网 + - SoftAP 配网 + - WPS 配网 + * - 默认固件支持情况 + - |icon-green-check| + - |icon-red-cross| (:ref:`备注 1 `) + - |icon-green-check| + * - 是否需要 BLE + - |icon-red-cross| + - |icon-red-cross| + - |icon-red-cross| + * - 是否需要额外的手机 APP + - |icon-green-check| (:ref:`备注 2 `) + - |icon-green-check| + - |icon-red-cross| + * - 配网成功率 + - 较高 + - 高 + - 高 + * - 操作复杂性 + - 简单 + - 复杂 + - 复杂 + * - 推荐指数 + - 推荐 + - 中等 + - 中等 + +.. _np-note: + + - 备注 1:若想 AT 固件中支持 SoftAP 配网,请参考: :doc:`../AT_Command_Set/Web_server_AT_Commands`。 + - 备注 2:使用 SmartConfig 中的 AirKiss 类型配网时需依赖微信 APP,国外用户可能无法使用微信 APP。 + + .. only:: esp32c2 + + - 备注 3: 默认的 ESP32C2-4MB AT 固件支持 BluFi 功能,而 ESP32C2-2MB AT 固件不支持 BluFi 功能。有关详细信息,请参阅 :ref:`Bluetooth LE AT 命令简介 `。 + +.. only:: not esp32s2 + + .. _example-at_blufi: + + BluFi 配网 + ------------ + + BluFi 是一款基于蓝牙通道的 Wi-Fi 网络配置功能,更多信息请参考 `BluFi 文档 `_。 + + #. 在手机端安装 EspBluFi 应用程序。 + + - Android:`安卓端 EspBluFi 下载 `_ (`安卓端源码 `_) + - iOS:`iOS 端 EspBluFi 下载 `_ (`iOS 端源码 `_) + + #. {IDF_TARGET_NAME} 设备设置 BluFi 名称。 + + 命令: + + .. code-block:: none + + AT+BLUFINAME="blufi_test" + + 响应: + + .. code-block:: none + + OK + + #. 开启 BluFi。 + + 命令: + + .. code-block:: none + + AT+BLUFI=1 + + 响应: + + .. code-block:: none + + OK + + #. 手机创建 BluFi 连接并进行配网。 + + 4.1 BluFi 连接 + + 手机打开系统蓝牙和 GPS 定位功能,启动 EspBluFi 应用程序,找到名为 ``blufi_test`` 的设备并点击进入,再点击 ``连接`` 进行连接。此时,ESP 设备端应打印类似于 ``+BLUFICONN`` 的日志,应用程序页面也会输出类似以下信息,表明 BluFi 连接已成功建立。 + + .. code-block:: none + + Connected + + Discover service and characteristics success + + Set notification enable complete + + Set mtu complete, mtu=... + + 4.2 BluFi 配网 + + 连接完成后,在 EspBluFi 应用程序中点击 ``配网`` 按钮,页面将会跳转至 ``配置`` 页面。在此页面输入 Wi-Fi 的 SSID 和密码,并点击 ``确定`` 按钮开始配网。稍等片刻,应用程序页面也会显示类似以下信息。 + + .. code-block:: none + + Post configure params complete + + Receive device status response: + OpMode: Station + Station connect Wi-Fi now + Station connect Wi-Fi bssid: + Station connect Wi-Fi ssid: + + 4.3 配网成功 + + 请稍等片刻,ESP 设备将输出以下日志。至此,ESP 设备的配网已成功完成。 + + .. code-block:: none + + WIFI CONNECTED + WIFI GOT IP + + #. (可选步骤){IDF_TARGET_NAME} 设备发送 BluFi 用户自定义数据。 + + 命令: + + .. code-block:: none + + AT+BLUFISEND=4 + + 响应: + + .. code-block:: none + + > + + 输入 4 字节数据,例如输入数据是 ``test``,之后 AT 将会输出以下信息。 + + .. code-block:: none + + OK + + 此时手机应用程序端显示了类似以下信息: + + .. code-block:: none + + Receive custom data: + test + + #. {IDF_TARGET_NAME} 设备关闭 BluFi。 + + 命令: + + .. code-block:: none + + AT+BLUFI=0 + + 响应: + + .. code-block:: none + + +BLUFIDISCONN + + OK + + 此时手机应用程序端显示了类似以下信息: + + .. code-block:: none + + Disconnect , status=19 + +.. _example-at_smartconfig: + +SmartConfig 配网 +-------------------- + +AT SmartConfig 配网有四种类型,分别是 ESP-TOUCH、AirKiss、ESP-TOUCH+AirKiss 和 ESP-TOUCH v2。以下是 AirKiss 和 ESP-TOUCH v2 类型的配网示例。 + +ESP-TOUCH v2 配网示例 +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +#. 在手机端安装 EspTouch 应用程序。 + + - Android:`安卓端 EspTouch 下载 `_ (`安卓端应用程序源码 `_) + - iOS:`iOS 端 EspTouch 下载 `_ (`iOS 端应用程序源码 `_) + +#. 设置 ESP 设备为 Station 模式。 + + 命令: + + .. code-block:: none + + AT+CWMODE=1 + + 响应: + + .. code-block:: none + + OK + +#. {IDF_TARGET_NAME} 设备开启 SmartConfig。 + + 命令: + + .. code-block:: none + + AT+CWSTARTSMART=4,0,"1234567890123456" + + 响应: + + .. code-block:: none + + OK + +#. 在手机端进行配网。 + + 请按照以下步骤操作:打开手机的 Wi-Fi,连接到目标网络(例如 SSID:test,密码:1234567890),启动 EspTouch 应用程序,点击 ``EspTouch V2`` 按钮。在跳转的页面中输入所连接 Wi-Fi 的密码、待配网的设备数量以及 AES 密钥,如下所示: + + .. code-block:: none + + Wi-Fi 密码:1234567890 + 需要配网的设备数量:1 + AES 密钥:1234567890123456 + +#. 在 ESP 设备端确认配网成功。 + + 此时 ESP 设备端会输出类似如下信息: + + .. code-block:: none + + smartconfig type:ESPTOUCH_V2 + Smart get wifi info + ssid:test + password:1234567890 + WIFI CONNECTED + WIFI GOT IP + smartconfig connected wifi + + 到此,ESP 设备的配网已成功完成。 + +#. {IDF_TARGET_NAME} 设备停止 SmartConfig。 + + 命令: + + .. code-block:: none + + AT+CWSTOPSMART + + 响应: + + .. code-block:: none + + OK + +AirKiss 配网示例 +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +#. 打开手机微信,搜索并关注“乐鑫信息科技”公众号。 + +#. 设置 ESP 设备为 Station 模式。 + + 命令: + + .. code-block:: none + + AT+CWMODE=1 + + 响应: + + .. code-block:: none + + OK + +#. {IDF_TARGET_NAME} 设备开启 SmartConfig。 + + 命令: + + .. code-block:: none + + AT+CWSTARTSMART=2 + + 响应: + + .. code-block:: none + + OK + +#. 在手机端进行配网。 + + 手机连接到要配网的 Wi-Fi(例如 SSID:test,密码:1234567890),然后打开微信,进入“乐鑫信息科技”公众号,点击产品资源,找到 AirKiss 设备并进入。在跳转的页面中输入 Wi-Fi 密码 ``1234567890``,稍等片刻,手机页面将显示类似日志 ``配置成功......``。 + + 此时 ESP 设备端会输出类似如下信息: + + .. code-block:: none + + smartconfig type:AIRKISS + Smart get wifi info + ssid:test + password:1234567890 + WIFI CONNECTED + WIFI GOT IP + smartconfig connected wifi + + 到此,ESP 设备的配网已成功完成。 + +#. {IDF_TARGET_NAME} 设备停止 SmartConfig。 + + 命令: + + .. code-block:: none + + AT+CWSTOPSMART + + 响应: + + .. code-block:: none + + OK + +.. _example-at_softap: + +SoftAP 配网 +-------------------- + +AT SoftAP 配网指的是 WEB 配网。有关详细信息,请参见 :doc:`Web Server AT 示例 <../AT_Command_Examples/Web_server_AT_Examples>`。 + +.. _example-at_wps: + +WPS 配网 +-------------------- + +#. 准备一个支持 WPS 配网的路由器(例如 Wi-Fi SSID: test)。 + +#. 设置 ESP 设备为 Station 模式。 + + 命令: + + .. code-block:: none + + AT+CWMODE=1 + + 响应: + + .. code-block:: none + + OK + +#. {IDF_TARGET_NAME} 设备开启 WPS 配网。 + + 命令: + + .. code-block:: none + + AT+WPS=1 + + 响应: + + .. code-block:: none + + OK + + 此时根据路由器的使用手册,开启 WPS 功能,稍等片刻,ESP 设备端会输出类似如下信息,即设备配网已成功。 + + .. code-block:: none + + WIFI CONNECTED + WIFI GOT IP + +#. 查询 {IDF_TARGET_NAME} 设备连接上的 Wi-Fi 信息。 + + 命令: + + .. code-block:: none + + AT+CWJAP? + + 响应: + + .. code-block:: none + + +CWJAP:"test",...... + OK + +#. {IDF_TARGET_NAME} 设备关闭 WPS 配网。 + + 命令: + + .. code-block:: none + + AT+WPS=0 + + 响应: + + .. code-block:: none + + OK