diff --git a/docs/README-esp-matter.md b/docs/README-esp-matter.md index 7b03d53df92401a94d8029a07f22b39505e134f2..064f09093482ca7f45807d2f1961161d39ebc878 100644 --- a/docs/README-esp-matter.md +++ b/docs/README-esp-matter.md @@ -131,4 +131,35 @@ cd esp-matter cd esp-matter/examples/light idf.py set-target esp32c3 idf.py build -``` \ No newline at end of file +``` + +## 2 控制 +### 2.1 对 Matter 设备进行配网与基本控制 +首先,使用在交互模式下的 CHIP Tool 进行配网。先为配网开启一个新的终端,配置 Matter 的开发环境,并运行: + +cd esp-idf; source ./export.sh; cd .. +cd esp-matter; source ./export.sh; cd .. +export IDF_CCACHE_ENABLE=1 +chip-tool interactive start + +### 对设备进行配网具有多种途径,这里我们使用 BLE Wi-Fi 的方式进行配网,复制如下指令: + +pairing ble-wifi 0x7283 20202021 3840 +在上述指令中,0x7283 是随机选取的节点 ID,20202021 是配对码,3840 是鉴别码,粘贴命令到终端,确保电脑与所填 Wi-Fi 在同一网络环境内,在 SSID 填入 Wi-Fi 名称,passphrase 填入密码。 + +填写完成后的示例如下: + +pairing ble-wifi 0x7283 Espressif password 20202021 3840 +开始运行,等待一段时间,当监控设备的终端中出现以下日志时,即代表配网成功: + +I (347065) app_main: Commissioning complete +I (347065) esp_matter_core: Commissioning Complete +在配网完成后,我们尝试使用一个命令来对 ESP32-C3 开发板上的 RGB 灯进行控制,复制以下开关翻转的命令到 CHIP Tool 终端中运行: + +onoff toggle 0x7283 0x1 +在监控设备的终端中我们可以看到 Received command 相关日志: + +I (122717) esp_matter_command: Received command 0x00000002 for endpoint 0x0001's cluster 0x00000006 +I (122717) esp_matter_attribute: ********** R : Endpoint 0x0001's Cluster 0x00000006's Attribute 0x00000000 is 1 ********** +I (122727) chip[ZCL]: Toggle ep1 on/off from state 1 to 0 +即代表收到了指令的请求,同时,我们也可以看到开发板上的 RGB 灯关闭了,再次运行,RGB 灯被点亮。 \ No newline at end of file