Skip to content

Commit

Permalink
add callback async_get_supported_voices()
Browse files Browse the repository at this point in the history
  • Loading branch information
7floor committed Aug 11, 2024
1 parent 8ed0748 commit 006c6db
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion custom_components/rhvoice/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import async_timeout
import voluptuous as vol
from aiohttp import ClientError
from homeassistant.components.tts import PLATFORM_SCHEMA, Provider
from homeassistant.components.tts import PLATFORM_SCHEMA, Provider, Voice, callback
from homeassistant.const import (
CONF_HOST,
CONF_PORT,
Expand Down Expand Up @@ -104,6 +104,11 @@ def supported_options(self):
"""Return list of supported options."""
return SUPPORTED_OPTIONS

@callback
def async_get_supported_voices(self, language: str) -> list[Voice] | None:
"""Return a list of supported voices for a language."""
return [Voice(voice, voice) for voice in SUPPORTED_LANGUAGES[language]]

async def async_get_tts_audio(self, message, language, options=None):
"""Load TTS from RHVoice."""
websession = async_get_clientsession(self.hass)
Expand Down

0 comments on commit 006c6db

Please sign in to comment.