mirror of
https://github.com/home-assistant/core.git
synced 2026-07-05 21:55:36 +01:00
d766aae436
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: frenck <195327+frenck@users.noreply.github.com>
22 lines
551 B
Python
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)
|