-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use default voice id as fallback in get_tts_audio #123624
Use default voice id as fallback in get_tts_audio #123624
Conversation
@@ -100,7 +100,7 @@ async def async_get_tts_audio( | |||
"""Load tts audio file from the engine.""" | |||
_LOGGER.debug("Getting TTS audio for %s", message) | |||
_LOGGER.debug("Options: %s", options) | |||
voice_id = options[ATTR_VOICE] | |||
voice_id = options.get(ATTR_VOICE, self._default_voice_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we already always have voice set during setup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean default_voice_id? It is a string that is set in init, so before the Entity is passed to async_add_entities
. I verified the test I added failed beforehand and works now and I can't manage to run into the #123597 issue with this branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean ATTR_VOICE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. We're setting CONF_VOICE
during setup, ATTR_VOICE
is injected in the prepare_text_to_speech
method of a PipelineRun, but only if the voice is set by the user. Since this isn't the case in the automation that raised the issue, we need the .get()
here
Proposed change
We fallback to default voice id if voice is not set in options dict passed to
get_tts_audio
.Type of change
Additional information
Checklist
ruff format homeassistant tests
)