增加国际化支持,增加更多的选项。

This commit is contained in:
Howell Jiang
2025-04-18 00:00:01 +08:00
parent cd430ff498
commit 11751babd1
26 changed files with 1097 additions and 587 deletions
+40
View File
@@ -0,0 +1,40 @@
"""Integration for Baidu Voice services."""
import logging
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["stt", "tts"]
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""设置百度语音集成."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""设置百度语音配置项."""
# 存储配置数据
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN] = entry.data.copy() # 保存所有配置数据
# 加载平台
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""卸载百度语音配置项."""
# 卸载平台
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
hass.data.pop(DOMAIN)
return unload_ok