1
0
mirror of https://github.com/home-assistant/core.git synced 2026-07-03 20:56:06 +01:00
Files
core/homeassistant/components/picotts/__init__.py
T
2026-04-30 21:14:48 +02:00

30 lines
917 B
Python

"""The Pico TTS integration."""
import shutil
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryError
from .const import DOMAIN
PLATFORMS: list[Platform] = [Platform.TTS]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Pico TTS from a config entry."""
if await hass.async_add_executor_job(shutil.which, "pico2wave") is None:
raise ConfigEntryError(
translation_domain=DOMAIN, translation_key="binary_not_found"
)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)