Add name to tts voices (#91814)

* Add name to tts voices

* Add new file
This commit is contained in:
Erik Montnemery 2023-04-22 02:41:14 +02:00 committed by GitHub
parent c6d846453d
commit 9a0de43f98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 8 deletions

View file

@ -9,6 +9,7 @@ from homeassistant.components.tts import (
CONF_LANG,
PLATFORM_SCHEMA,
Provider,
Voice,
)
from homeassistant.core import callback
@ -97,9 +98,11 @@ class CloudProvider(Provider):
return [ATTR_GENDER, ATTR_VOICE, ATTR_AUDIO_OUTPUT]
@callback
def async_get_supported_voices(self, language: str) -> list[str] | None:
def async_get_supported_voices(self, language: str) -> list[Voice] | None:
"""Return a list of supported voices for a language."""
return TTS_VOICES.get(language)
if not (voices := TTS_VOICES.get(language)):
return None
return [Voice(voice, voice) for voice in voices]
@property
def default_options(self):