fix: 添加实际的扫描命令发送

start_scanning() 方法现在会发送 AT+PROV=SCAN 命令到网关
之前只设置了状态但没有发送实际扫描命令,导致扫描不到设备
This commit is contained in:
impressionyang 2026-04-16 16:02:02 +08:00
parent 13e2b36a0c
commit cbb36d7300

View File

@ -145,9 +145,14 @@ class ProvisioningManager:
self._devices = {} self._devices = {}
self._scan_result = [] self._scan_result = []
# 发送扫描命令 # 发送扫描命令AT+PROV=SCAN
# 注意:实际扫描由网关自动广播触发,这里只需等待设备上报 # 网关会开始扫描周围的配网设备,设备响应后通过串口上报
_LOGGER.info("开始扫描设备,等待设备上报...") try:
await self.serial_reader.write_command("AT+PROV=SCAN")
_LOGGER.info("已发送扫描命令,等待设备响应...")
except Exception as e:
_LOGGER.error("发送扫描命令失败:%s", e)
self._set_state(ProvState.PROV_FAILED)
async def start_provisioning(self, device_address: str) -> None: async def start_provisioning(self, device_address: str) -> None:
"""开始配网指定设备。 """开始配网指定设备。