I can’t get Google Text-to-Speech working in OH3. I followed the docs a few times.
Billing is enabled, Cloud Text-to-Speech API is activated. Created a OAuth 2.0 Client ID credential called openhab3. For type I selected “Desktop” instead of “TV and Limited Input” because I received the same error as described in this post.
Called the URL with my client-id, approve and get the authorization code. I enter the code in OH3 settings -> Google Cloud Text-to-Speech -> Authorization Code and save. In openhab.log I get two warnings:
[WARN ] [.googletts.internal.GoogleTTSService] - Audio format OGG_OPUS is not yet supported.
In the CLI, I try it with
openhab> openhab:voice say Hello World
I get an error in openhab.log:
2021-01-24 11:23:51.673 [WARN ] [core.voice.internal.VoiceManagerImpl] - Error saying 'Hello World ': Missing API key, configure it first before using
org.openhab.core.voice.TTSException: Missing API key, configure it first before using
at org.openhab.voice.voicerss.internal.VoiceRSSTTSService.synthesize(VoiceRSSTTSService.java:110) ~[?:?]
at org.openhab.core.voice.internal.VoiceManagerImpl.say(VoiceManagerImpl.java:221) [bundleFile:?]
Checking the setting in OH3, I see the Authorization Code is empty again. If I enter it manually again, I get the error:
2021-01-24 11:25:31.738 [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
2021-01-24 11:25:31.740 [WARN ] [ce.googletts.internal.GoogleCloudAPI] - Error initializing Google Cloud TTS service: Error fetching access token. Invalid authcode? Please generate a new one.
I assume the last part makes sense. It looks like the authorization code is working, so it is removed in the settings. If I try to use it again, it’s invalid because it has already been used successfully once.
What is going wrong here?
Thanks for any help