Skip to content

Commit

Permalink
Merge pull request #13 from 7floor/master
Browse files Browse the repository at this point in the history
add callback async_get_supported_voices()
  • Loading branch information
definitio authored Aug 12, 2024
2 parents 8ed0748 + 006c6db commit 85e0a34
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 85e0a34

Please sign in to comment.