Files
core/homeassistant/components/picotts/__init__.py
T
2026-04-02 11:41:47 +02:00

32 lines
953 B
Python

"""The Pico TTS integration."""
from __future__ import annotations
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)