Text based configuration of Google Cloud Text-to-Speech settings

Hi all, I recently started to use Google Cloud Text-to-Speech which is working great. Unfortunately I started the set-up by the web interface. But as all of my configuration is text-based (addons.cfg, runtime.cfg, etc.) I would like to switch the Google t2s Setup also to a cfg file. But I can not find any example of the variables I need to put in this file. Can anyone help me?

1 Like

The documentation should be enhanced with an example of configuration, I agree.
Will try to do it during the weekend,

2 Likes

You are amazing, thank you so much!!!

Any Updates if I might ask?

Yes, documentation was updated with a full example.

1 Like

Amazing, thank you so much. Buy where can I find it? Is there a chance to place it also here Google Cloud Text-to-Speech - Voices | openHAB for others?

I think you van find it here: Google Cloud Speech-to-Text - Voices | openHAB

This is not the good link, STT vs TTS.

1 Like
1 Like

Thank you so much @Lolodomo

Can it be, that the authcode is just active until restarting openhab?

I placed the authcode inside the googletts.cfg file:

...
org.openhab.voice.googletts:clientSecret=GOCSPX-PHyxxxxxxxxxxxxxxxxxxxxxxxxS
org.openhab.voice.googletts:authcode=4/1AX4Xfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0-UbEaFlvZQhDb8
org.openhab.voice.googletts:pitch=0
....

After the configuration was updatet and service was running, I commented it out:

...
org.openhab.voice.googletts:clientSecret=GOCSPX-PHyxxxxxxxxxxxxxxxxxxxxxxxxS
#org.openhab.voice.googletts:authcode=4/1AX4Xfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0-UbEaFlvZQhDb8
org.openhab.voice.googletts:pitch=0
....

It worked for a long time, until I rebooted openhab.
After that it did not work anymore:

Error saying 'Test': No TTS service can be found for voice googletts:deDEWavenetC

After i removed the comment char # and saved the configuration, I got following failure:

2022-03-09 11:08:22.022 [WARN ] [ce.googletts.internal.GoogleCloudAPI]
Error initializing Google Cloud TTS service: Error fetching access token. Invalid authcode? Please generate a new one.
2022-03-09 11:08:22.001 [ERROR] [oauth2client.internal.OAuthConnector]
grant type authorization_code to URL https://accounts.google.com/o/oauth2/token failed with error code invalid_grant, description Bad Request

Do I need to do this after every restart?

1 Like

Even worse. Getting the Authcode as described

is not working anymore. Google says failure 400 invalid request, not according to Google OAuth Guidlines. As the link is in my bookmarks, it is the same as always, so something changed on Googles site.

1 Like

Same to me…

1 Like

Same here , nothing new ?

I ran into this problem and fought with it, currently seem to have it sorted.
Compare Google TTS Authentication: Error 400: redirect_uri_mismatch - #7 by rubens

One caveat remains: when using textual config for googletts I had to re-authorize after each openhab restart, probably cause the Authcoderemained in the config file but is used up after the authorization. thus I returned to configuring this via UI.