修复实体设备不显示问题

- 重写 sensor.py,使用 Home Assistant 内置 MQTT 组件
- 修复配置流程标题显示
- 添加更好的错误处理和日志记录
- 创建 MQTT 测试脚本
- 统一所有日志信息为 JackeryHome
This commit is contained in:
不求圣剑
2025-10-14 11:04:32 +08:00
parent 7f5b5492ca
commit 04821cb501
4 changed files with 173 additions and 187 deletions

View File

@@ -12,8 +12,8 @@ PLATFORMS = [Platform.SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Energy Monitor from a config entry."""
_LOGGER.info("Setting up Energy Monitor integration")
"""Set up JackeryHome from a config entry."""
_LOGGER.info("Setting up JackeryHome integration")
# 存储配置数据
hass.data.setdefault(DOMAIN, {})
@@ -27,7 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
_LOGGER.info("Unloading Energy Monitor integration")
_LOGGER.info("Unloading JackeryHome integration")
# 卸载传感器平台
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)