Only store strings in cloud TTS default options (#140332)

* Only store strings in cloud TTS default options

* more type check

* Don't stringify strenum
This commit is contained in:
Paulus Schoutsen 2025-03-11 15:28:13 -04:00 committed by GitHub
parent 6fb6f92985
commit 7aeefa1400
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -286,7 +286,7 @@ class CloudTTSEntity(TextToSpeechEntity):
return self._language return self._language
@property @property
def default_options(self) -> dict[str, Any]: def default_options(self) -> dict[str, str]:
"""Return a dict include default options.""" """Return a dict include default options."""
return { return {
ATTR_AUDIO_OUTPUT: AudioOutput.MP3, ATTR_AUDIO_OUTPUT: AudioOutput.MP3,
@ -363,7 +363,7 @@ class CloudTTSEntity(TextToSpeechEntity):
_LOGGER.error("Voice error: %s", err) _LOGGER.error("Voice error: %s", err)
return (None, None) return (None, None)
return (str(options[ATTR_AUDIO_OUTPUT].value), data) return (options[ATTR_AUDIO_OUTPUT], data)
class CloudProvider(Provider): class CloudProvider(Provider):
@ -404,7 +404,7 @@ class CloudProvider(Provider):
return [Voice(voice, voice) for voice in voices] return [Voice(voice, voice) for voice in voices]
@property @property
def default_options(self) -> dict[str, Any]: def default_options(self) -> dict[str, str]:
"""Return a dict include default options.""" """Return a dict include default options."""
return { return {
ATTR_AUDIO_OUTPUT: AudioOutput.MP3, ATTR_AUDIO_OUTPUT: AudioOutput.MP3,
@ -444,7 +444,7 @@ class CloudProvider(Provider):
_LOGGER.error("Voice error: %s", err) _LOGGER.error("Voice error: %s", err)
return (None, None) return (None, None)
return (str(options[ATTR_AUDIO_OUTPUT].value), data) return options[ATTR_AUDIO_OUTPUT], data
@callback @callback