impress_sig_mesh_hacs/问题修复记录.md
impressionyang 09bf82da9a docs: 添加问题修复记录
记录 2026-04-15 配置向导 500 错误的修复过程

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 19:03:59 +08:00

55 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 问题修复记录
## 2026-04-15: 修复配置向导 500 错误
### 问题描述
添加集成时出现 500 Internal Server Error
### 根本原因
1. **类型注解错误**`config_flow.py` 使用了小写 `any` 而非 `Any`
2. **依赖包不存在**`manifest.json` 中引用了不存在的 `bleak-mesh>=0.2.0`
### 错误日志
```
homeassistant.requirements.RequirementsNotFound:
Requirements for sigmesh_gateway not found: ['bleak-mesh>=0.2.0'].
```
### 解决方案
#### 修复 1: config_flow.py 类型注解
```diff
+ from typing import Any
- async def async_step_user(self, user_input: dict[str, any] | None = None) -> FlowResult:
+ async def async_step_user(self, user_input: dict[str, Any] | None = None) -> FlowResult:
- async def async_step_init(self, user_input: dict[str, any] | None = None) -> FlowResult:
+ async def async_step_init(self, user_input: dict[str, Any] | None = None) -> FlowResult:
```
#### 修复 2: manifest.json 依赖
```diff
- "requirements": ["pyserial-asyncio==0.6", "bleak-mesh>=0.2.0"],
+ "requirements": ["pyserial-asyncio-fast>=0.6"],
```
### 提交记录
| Commit | 说明 |
|--------|------|
| 66b86e3 | fix: 修复 config_flow.py 类型注解错误 |
| e905410 | fix: 修复 manifest.json 依赖错误 |
### 部署步骤
```bash
# 复制更新后的集成文件
cp -r /home/ubuntu/workspace/cherry-studio/enginneer/impress_sig_mesh_hacs/custom_components/sigmesh_gateway \
<HA 配置目录>/custom_components/
# 重启 Home Assistant
ha core restart
```
### 验证
重启后,在 HA UI 中重新尝试添加集成,应能正常显示配置表单。