1
0
mirror of https://github.com/home-assistant/core.git synced 2026-07-05 21:55:36 +01:00
Files
core/homeassistant/components/tts/helper.py
T
2026-04-30 21:14:48 +02:00

22 lines
551 B
Python

"""Provide helper functions for the TTS."""
from typing import TYPE_CHECKING
from homeassistant.core import HomeAssistant
from .const import DATA_COMPONENT, DATA_TTS_MANAGER
if TYPE_CHECKING:
from . import TextToSpeechEntity
from .legacy import Provider
def get_engine_instance(
hass: HomeAssistant, engine: str
) -> TextToSpeechEntity | Provider | None:
"""Get engine instance."""
if entity := hass.data[DATA_COMPONENT].get_entity(engine):
return entity
return hass.data[DATA_TTS_MANAGER].providers.get(engine)