jjlawren / sonos_cloud

Sonos cloud API integration for Home Assistant with improved TTS/alerts handling
121 stars 5 forks source link

[Question] Volume on TTS-requests #11

Closed rasmusbe closed 2 years ago

rasmusbe commented 2 years ago

Thanks for this integration!

Is it possible to set volume on TTS calls?

jjlawren commented 2 years ago

Not at the current time. The core tts component doesn't allow passing through a volume parameter in the tts.*_say calls. https://github.com/home-assistant/core/pull/53630 was created to try and allow this but that method was not accepted.

It's possible with a tts custom component that integrates the change in the PR above, but I don't recommend overriding built-in integrations.

rasmusbe commented 2 years ago

Oh I see, too bad! Thanks for the answer!

pawelkw commented 2 years ago

@rasmusbe Would it be possible to have a globally configurable volume for alerts that would be used on every request, which would resolve problems which this use case?

rasmusbe commented 2 years ago

Yes, that would work for me :)

pawelkw commented 2 years ago

Haha, I messed up. I wanted to tag @jjlawren to get his opinion on that approach and if it would be possible to implement.

jjlawren commented 2 years ago

Unfortunately not, as the requested volume level would still need to be passed through the core TTS service, which in turn calls media_player.play_media.

An alternative if your TTS messages are fairly static is to save the TTS messages as audio files locally, and just send them directly to media_player.play_media along with the requested volume level.

jjlawren commented 2 years ago

Heads-up, setting volumes for TTS will be possible after HA 2022.3 launches. Also, a new default volume has been added in 0.1.1, but this still only applies to media_player.play_media calls for now.