ESP RainMaker Matter 控制器
| 技术方案 | Classic + Matter |
|---|---|
| 应用场景 | 家电与控制 |
Matter 设备只在家庭网络内通信,单靠自身无法从外部访问。本示例将 ESP32-S3 变成常在线的 Matter 控制器:加入您的 ESP RainMaker 家庭,列出其中任意品牌的 Matter 设备,并将状态同步到云端,让您随时随地查看和控制。此固件支持 Wi-Fi 设备;Thread 需要搭配 ESP32-H2 的边界路由器版本。可作为墙面面板、网关和音箱等全屋控制产品的起点。
产品应用场景
- 在家时:集成 ESP RainMaker Matter 控制器的墙面面板通过 Matter 直接控制您的 Matter 设备,无需云端。
- 外出时:ESP RainMaker Home App 经由云端和 Matter 控制器控制同样的设备。
概览
| 处理器 | ESP32-S3(8 MB flash,八线 PSRAM) |
|---|---|
| 连接方式 | Wi-Fi + BLE |
| 供电电压 | 3.3V |
| IDF 版本 | ESP-IDF v5.5.x |
| SDK | 基于 ESP RainMaker 的 ESP-Matter v1.5 |
准备物品
- ESP32-S3 开发板,8 MB flash,八线 PSRAM
- USB 数据线
- Chrome 或 Edge 浏览器(Web Serial)
- ESP RainMaker Home App(网页版或手机版)和 esp-rainmaker-cli
- 已用 ESP RainMaker Home 手机 App 添加到家庭的 Matter 设备(Wi-Fi,不限品牌)
可体验的功能
- 加入您的家庭: 用 ESP RainMaker Home App 添加控制器,并将其绑定到您的家庭。
- 发现所有设备: 列出家庭中任意品牌的 Matter 设备,并在云端实时更新其在线状态和当前状态。
- 随时随地控制: 即使不在家,也能通过 ESP RainMaker 开关设备并读取其状态。
- 本地命令: 直接在设备控制台发送 Matter 命令,方便在工作台上测试。
- 支持 Thread: 外接一块 ESP32-H2 并重新编译,即可让控制器成为 Thread 边界路由器,同样可以控制 Thread 设备。
- 远程管理: 远程重启、重置 Wi-Fi 或恢复出厂设置,并通过 OTA 更新固件。
在真实开发板上体验
从乐鑫或其授权分销商购买官方开发板,然后直接在本页烧录此示例。 选购乐鑫开发板
烧录并体验
选择部署
公共部署
由乐鑫托管,供评估使用。免费,无需任何部署。
- 烧录: 连接 ESP32-S3,选择“擦除并烧录”,然后点击“复位”。控制台中会出现二维码。
- 添加到 ESP RainMaker Home App: 在 Home App 面板中点击 +,通过蓝牙添加设备并输入控制台中的 PoP,连接 Wi-Fi 并接受授权提示。使用手机时可直接扫描二维码。
- 绑定到家庭: 查看控制台下方的“设备标识”。如果显示“需要绑定家庭”,运行其中给出的命令。
- 远程控制: 在其他网络下打开 ESP RainMaker Home 手机 App(非网页版),开关一台标为 Controller 的 Matter 设备。也可以使用 esp-rainmaker-cli。
详细说明
1. 准备工作
- 一块 8 MB flash、八线 PSRAM 的 ESP32-S3 开发板,以及一根 USB 数据线。
- 一个用于 Home App(控制台旁的面板或手机 App)的 ESP RainMaker 账号,以及登录同一账号的
esp-rainmaker-cli:pip install esp-rainmaker-cli esp-rainmaker-cli login
- 已用 ESP RainMaker Home 手机 App 添加到家庭的 Matter 设备(Wi-Fi,不限品牌),例如 ESP RainMaker + Matter 设备。也可以之后再添加。
2. 烧录控制器
- 点击控制台上方的
连接,选择开发板的串口。 - 点击
烧录设备,选择擦除并烧录,等待完成。 - 点击
复位,控制台中会出现二维码。
3. 在 ESP RainMaker Home App 中添加
- 在控制台旁的 Home App 面板中,保持 ESP RainMaker Classic 部署,并用存有 Matter 设备的账号登录。使用手机 App 时,点击
+扫描控制台中的二维码,然后直接跳到 Wi-Fi 步骤。 - 点击
+,选择 I do not have a QR code,再选择 Bluetooth。 - 在 Chrome 的蓝牙窗口中,选择与控制台中名称一致的设备,例如
PROV_ff7bf2。 - 出现提示时输入 PoP。请从控制台
QRCODE:行中准确复制"pop"的值。 - 连接到与 Matter 设备相同的 Wi-Fi 网络。
- 如果 App 提示,选择存有 Matter 设备的家庭,并接受授权控制器的提示。
4. 绑定到家庭
- 查看控制台下方的设备标识。控制器加入家庭后,控制器设置会变为就绪。
- 如果显示需要绑定家庭,列出您的家庭,并记下包含 Matter 设备的家庭 ID:
esp-rainmaker-cli group list
- 运行面板中显示的命令,将
<home-group-id>替换为该 ID。控制器只能绑定一次,请仔细核对 ID。
5. 查看设备
- 面板中的 Matter 设备列出家庭中的每台设备及其在线状态。设备有增减后,请运行面板中显示的刷新命令。
- 用复制按钮复制控制器的 RainMaker 节点 ID 和某台设备的 Matter 节点 ID,下一步的 esp-rainmaker-cli 命令会用到这两个 ID。
6. 随时随地控制设备
- 让手机离开家中 Wi-Fi,例如改用移动数据,然后打开 ESP RainMaker Home 手机 App。您的 Matter 设备会标为 Controller,表示 App 通过控制器访问它们。开关其中一台设备。请使用手机 App,而不是网页版。
- 或者使用
esp-rainmaker-cli,通过控制器切换设备开关:esp-rainmaker-cli create_cmd_request <rainmaker-node-id> 4352 \ '{"objects":[{"matter_node_id":"<matter-node-id>","matter_endpoint_id":"0x1"}], "request_payload":{"cluster_id":"0x6","command_id":"0x2","command_fields":{}}}' --timeout 60 - 用命令输出的请求 ID 获取结果。状态为
success表示设备已收到命令:esp-rainmaker-cli get_cmd_requests <request-id>
- 用同样的方式读回设备状态:
esp-rainmaker-cli create_cmd_request <rainmaker-node-id> 4354 \ '{"matter_node_id":"<matter-node-id>", "attribute_paths":[{"endpoint_id":"0x1","cluster_id":"0x6","attribute_id":"0x0"}]}' --timeout 60 - 如需快速本地测试,也可以直接在控制台中输入:
matter esp controller invoke-cmd <matter-node-id> 0x1 0x6 0x2
私有部署
您自己的 ESP RainMaker Classic 部署。请通过 Admin CLI 注册节点,而非 Dashboard。
- Register: With the ESP RainMaker Admin CLI, generate device certificates and register them with node_certs.csv.
- Load credentials: Zip the CLI batch folder (Mfg-…) or pick one node's .bin from its bin/ folder, and drop it into Device credentials.
- Flash: Write the firmware and the credentials in one pass. The board resets when done.
- Pair: Sign in to your private Classic deployment in the Home App, then add the device with the PoP from the console.
详细说明
1. Before you start
- A private ESP RainMaker Classic deployment (you need its deployment base URL and super-admin email from setup).
- The ESP RainMaker Admin CLI installed on your computer (esp-rainmaker-admin-cli).
- An ESP32-family DevKit that matches this example, a USB data cable, and Chrome or Edge.
2. Generate and register device certificates
- Follow the Admin CLI user guide. Set your deployment endpoint and log in:
python rainmaker_admin_cli.py account serverconfig --endpoint <your-deployment-base-url> python rainmaker_admin_cli.py account login --email <super-admin-email>
- Generate certificates for your boards (factory NVS images land under
bin/in the output folder):python rainmaker_admin_cli.py certs devicecert generate --count <n> --prov ble --outdir <outdir>
- Register them with the cloud using the batch's
common/node_certs.csv:python rainmaker_admin_cli.py certs devicecert register --inputfile <outdir>/<date>/Mfg-<no>/common/node_certs.csv
- Save the
request_idfrom the register command and check status when needed:python rainmaker_admin_cli.py certs devicecert getcertstatus --requestid <request_id>
- The output holds private keys. Keep it out of chats and repositories, and delete it when you are done.
3. Load the device credentials
- From the Admin CLI output folder, zip the
Mfg-<no>batch folder, or pick onebin/node-….binfile. - Drop that ZIP or
.binonto Device credentials above the console. It is read in your browser and never uploaded. - With the ZIP, pick the node for this board. Every board needs its own node: two boards with the same one connect as the same device.
- The credentials are flashed at
0x700000, where this example keeps itsfctrypartition.
4. Connect and flash
- Connect the board over USB, click
Connectabove the console and pick its port. - Click
Flash Deviceand choose Erase, then flash firmware + credentials. The firmware image goes to0x0and the credentials to0x700000in one pass, so the erase cannot wipe them. - The board resets when flashing is done. Type
get-node-idin the console when the firmware supports it: it prints the node you picked. - To give a board another node later, or restore one after a full erase, load the credentials and choose Credentials only. The firmware on the board is kept.
- To reflash only the firmware, choose Flash only. The credentials on the board are kept.
5. Sign in on your deployment
- In the Home App panel next to the console, sign in to your private ESP RainMaker Classic deployment (the base URL from your deployment setup).
- You can also use the ESP RainMaker phone app (iOS / Android); point it at the same deployment if your build supports a custom endpoint.
- Use a regular user account for day-to-day testing, not the super-admin account used with the Admin CLI.
6. Provision the device in the Home App
- Tap
+, choose I do not have a QR code, then Bluetooth. - In Chrome's Bluetooth window, pick the device whose name matches the one in the console, for example
PROV_ff7bf2. - Enter the PoP when asked. It is the
"pop"value in theQRCODE:line of the console, for example{"ver":"v1","name":"PROV_xxxxxx","pop":"xxxxxxxx","transport":"ble"}. - Pick your Wi-Fi network, enter its password and wait for provisioning to finish. The device then appears under My Devices.
- Control the device from the app.
控制器只能看到其绑定家庭中的 Matter 设备,例如 ESP RainMaker + Matter 设备。设备有增减后,请用设备标识中的命令刷新列表。
连接遇到问题?
- 确保设备已通过 USB 正确连接
- 检查是否已安装正确的驱动程序
- 尝试更换 USB 端口或数据线
- 确认设备已进入烧录模式
- 点击此处获取最新版 ESP RainMaker 手机 App