Wyoming tts (#91712)

* Add tts entity

* Add tts entity and tests

* Re-add name to TextToSpeechEntity

* Fix linting

* Fix ruff linting

* Support voice attr (unused)

* Remove async_get_text_to_speech_entity

* Move name property to Wyoming TTS entity

* Fix id

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Michael Hansen 2023-04-23 13:06:56 -05:00 committed by GitHub
parent f4df0ca50a
commit b6f2b29a99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 529 additions and 58 deletions

View file

@ -7,7 +7,7 @@ import pytest
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from . import STT_INFO
from . import STT_INFO, TTS_INFO
from tests.common import MockConfigEntry
@ -22,7 +22,7 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]:
@pytest.fixture
def config_entry(hass: HomeAssistant) -> ConfigEntry:
def stt_config_entry(hass: HomeAssistant) -> ConfigEntry:
"""Create a config entry."""
entry = MockConfigEntry(
domain="wyoming",
@ -37,10 +37,35 @@ def config_entry(hass: HomeAssistant) -> ConfigEntry:
@pytest.fixture
async def init_wyoming_stt(hass: HomeAssistant, config_entry: ConfigEntry):
"""Initialize Wyoming."""
def tts_config_entry(hass: HomeAssistant) -> ConfigEntry:
"""Create a config entry."""
entry = MockConfigEntry(
domain="wyoming",
data={
"host": "1.2.3.4",
"port": 1234,
},
title="Test TTS",
)
entry.add_to_hass(hass)
return entry
@pytest.fixture
async def init_wyoming_stt(hass: HomeAssistant, stt_config_entry: ConfigEntry):
"""Initialize Wyoming STT."""
with patch(
"homeassistant.components.wyoming.data.load_wyoming_info",
return_value=STT_INFO,
):
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.config_entries.async_setup(stt_config_entry.entry_id)
@pytest.fixture
async def init_wyoming_tts(hass: HomeAssistant, tts_config_entry: ConfigEntry):
"""Initialize Wyoming TTS."""
with patch(
"homeassistant.components.wyoming.data.load_wyoming_info",
return_value=TTS_INFO,
):
await hass.config_entries.async_setup(tts_config_entry.entry_id)