部分实体使用了错误的实体域名,可能导致 Home Assistant 2027.5.0 后停止工作
Author: danwangshiCreated Sep 6, 2026Updated Sep 6, 2026
Describe the Bug / 描述问题
问题描述
xiaomi_home 自定义集成在创建部分实体时,使用了错误的实体域名。
Home Assistant 日志中出现以下警告:
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain:
'xiaomi_home.mxiang_cn_1146963387_moc001_sound_and_light_warning_e_18_1'.
Expected domain is 'event'.
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain:
'xiaomi_home.mxiang_cn_1146963387_moc001_light_warning_mode_p_18_6'.
Expected domain is 'select'.
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain:
'xiaomi_home.mxiang_cn_1146963387_moc001_auto_sound_and_light_warning_p_2_15'.
Expected domain is 'switch'.
其他受影响的实体包括:
moc001_manual_sound_and_light_warning_p_2_16
moc001_warning_light_switch_p_18_3
moc001_warning_audio_switch_p_18_4
moc001_warning_repetition_p_18_1
moc001_warning_alarm_config_p_18_5
Home Assistant 认为这些实体应当分别属于以下实体域:
event
select
switch
text
但是当前生成的实体 ID 都以:
xiaomi_home.
作为前缀,而不是使用实际实体平台对应的域名。
运行环境
- Home Assistant Core:2026.8.2
- Python:3.14
- Xiaomi Home:v0.4.7
- 安装方式:Home Assistant Container
- 系统架构:x86_64 Linux
- 集成类型:自定义集成
复现步骤
1. 安装 Xiaomi Home 自定义集成 v0.4.7;
2. 配置包含声音、灯光或告警相关实体的 Xiaomi 设备;
3. 重启 Home Assistant;
4. 查看 Home Assistant 日志。
在实体初始化过程中会出现错误实体域名警告。
预期行为
实体 ID 的域名应与实体所属的平台保持一致,例如:
event.<entity_id>
select.<entity_id>
switch.<entity_id>
text.<entity_id>
或者不显式设置 entity_id,让 Home Assistant 根据实体平台和 unique_id 自动生成合法的实体 ID。
实际行为
集成生成了类似以下的实体 ID:
xiaomi_home.mxiang_cn_1146963387_moc001_sound_and_light_warning_e_18_1
xiaomi_home.mxiang_cn_1146963387_moc001_light_warning_mode_p_18_6
xiaomi_home.mxiang_cn_1146963387_moc001_auto_sound_and_light_warning_p_2_15
Home Assistant 产生如下警告:
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain.
This will stop working in Home Assistant 2027.5.0.
影响
目前这些实体似乎仍然能够创建和显示,但 Home Assistant 已明确提示,这种行为将在 2027.5.0
后停止工作。
潜在影响包括:
- 实体注册表中的实体域名不一致;
- 自动化和脚本无法正常引用实体;
- 实体服务调用失败;
- 按实体平台筛选时出现异常;
- Home Assistant 未来版本不再加载这些实体;
- 现有实体 ID 和自动化配置可能需要迁移。
建议修复方式
请检查 Xiaomi Home 集成中生成或设置 entity_id 的相关代码。
建议采用以下其中一种方式:
1. 将实体 ID 设置为实际实体平台对应的域名,例如:
- event
- select
- switch
- text
2. 不显式设置 entity_id,让 Home Assistant 根据实体平台和 unique_id 自动生成合法的实体 ID。
相关日志示例
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain:
'xiaomi_home.mxiang_cn_1146963387_moc001_sound_and_light_warning_e_18_1'.
Expected domain is 'event'.
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain:
'xiaomi_home.mxiang_cn_1146963387_moc001_light_warning_mode_p_18_6'.
Expected domain is 'select'.
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain:
'xiaomi_home.mxiang_cn_1146963387_moc001_auto_sound_and_light_warning_p_2_15'.
Expected domain is 'switch'.
感谢维护者。
### How to Reproduce / 复现步骤
1. 安装 Xiaomi Home 自定义集成 v0.4.7。
2. 使用以下环境运行 Home Assistant:
Home Assistant Core:2026.8.2
Python:3.14
安装方式:Home Assistant Container
系统架构:x86_64 Linux
3. 在 Xiaomi Home 集成中添加一个包含声音、灯光或告警相关实体的 Xiaomi 设备。
4. 确认设备已成功添加,并等待实体加载完成。
5. 重启 Home Assistant:
docker restart homeassistant
6. 等待 Home Assistant 完成启动。
7. 查看日志:
docker logs homeassistant 2>&1
或通过 Home Assistant 页面打开:
设置 → 系统 → 日志
8. 搜索:
wrong domain
9. 可以看到类似以下警告:
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain:
'xiaomi_home.mxiang_cn_1146963387_moc001_sound_and_light_warning_e_18_1'.
Expected domain is 'event'.
10. 其他实体也会出现相同问题,例如:
xiaomi_home.mxiang_cn_1146963387_moc001_light_warning_mode_p_18_6
实际应属于:
select
以及:
xiaomi_home.mxiang_cn_1146963387_moc001_auto_sound_and_light_warning_p_2_15
实际应属于:
switch
该问题在 Home Assistant 重启并重新加载 Xiaomi Home
实体时出现,不需要执行任何设备控制操作即可复现
### Expected Behavior / 预期结果
1. Home Assistant 成功加载 Xiaomi Home 集成和所有相关实体。 2. 日志中不应出现以下警告: sets an entity ID with wrong domain 3. 实体 ID 的域名应与实际实体平台一致: event.<entity_id> select.<entity_id> switch.<entity_id> text.<entity_id> 4. 例如: event.<device>_sound_and_light_warning select.<device>_light_warning_mode switch.<device>_auto_sound_and_light_warning 5. 实体在 Home Assistant 的实体注册表中应属于正确的平台,并且能够正常: - 显示状态; - 执行对应服务; - 被自动化和脚本引用; - 在 Home Assistant 后续版本中继续使用。 6. 实体 ID 不应使用: xiaomi_home.<entity_id> 作为实体域名。 7. 解决后,实体应兼容 Home Assistant 2027.5.0 及后续版本,不再因为错误的实体域名而停止工作。
### Reproduce Time / 问题复现的时间点
2026-09-06 10:54
### Home Assistant Logs / 系统日志
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain: 'xiaomi_home.isa_cn_1149057920_hlmax_hl_delete_voice_p_6_7'. Expected domain is 'text'. This will stop working in Home Assistant 2027.5.0, please create a bug report at https://github.com/XiaoMi/ha_xiaomi_home/issues
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain: 'xiaomi_home.isa_cn_1149057920_hlmax_hl_voice_config_p_6_14'. Expected domain is 'text'. This will stop working in Home Assistant 2027.5.0, please create a bug report at https://github.com/XiaoMi/ha_xiaomi_home/issues
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain: 'xiaomi_home.isa_cn_1149057920_hlmax_hl_light_alarm_event_p_6_20'. Expected domain is 'text'. This will stop working in Home Assistant 2027.5.0, please create a bug report at https://github.com/XiaoMi/ha_xiaomi_home/issues
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain: 'xiaomi_home.cuco_cn_690766450_cp6_model_info_p_9_2'. Expected domain is 'text'. This will stop working in Home Assistant 2027.5.0, please create a bug report at https://github.com/XiaoMi/ha_xiaomi_home/issues
Detected that custom integration 'xiaomi_home' sets an entity ID with wrong domain: 'xiaomi_home.cuco_cn_690766450_cp6_model_temp_speed_p_12_3'. Expected domain is 'text'. This will stop working in Home Assistant 2027.5.0, please create a bug report at https://github.com/XiaoMi/ha_xiaomi_home/issues
### Log Timezone / 日志时区
Asia/Shanghai
### Home Assistant Core Version / Home Assistant Core 版本
2026.8.2
### Home Assistant Operation System Version / Home Assistant Operation System 版本
不适用,当前使用 Home Assistant Container, Frontend 20260729.7
### Xiaomi Home Integration Version / 米家集成版本
v0.4.7
### Additional Context / 其他说明
_No response_
Source: XiaoMi/ha_xiaomi_home