mirror of
https://github.com/home-assistant/core.git
synced 2026-08-19 12:48:57 +01:00
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> Co-authored-by: Manu <4445816+tr4nt0r@users.noreply.github.com> Co-authored-by: Ariel Ebersberger <ariel@ebersberger.io>
32 lines
953 B
Python
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)
|