IIRC I sometimes ran into a similar issue during implementation of the OAuth2 authorization for Google TTS service. The reason for this was that the “copy to clipboard” method of GCP added a whitespace in front of (or behind, did not remember in detail) the secret. Can you check your copied values by pasting them.into a plain text editor in advance?
I have checked it and it doesn’t have any whitespaces or the like.
My token starts with 4/1AY0e-g7…
Is it normal to have special characters like / and - in there?
If that did not help you might want to enable TRACE log for org.openhab.voice.googletts and org.openhab.core.auth.oauth2client te get more information and see some details if the communication. If you need help to analyze it you can share the log with me. But it might be better to do that via PM because of sensitive data.
I basically ran into the same situation like Bob but then finally was able to get the authorization code (you also have make sure that in the google api “consent screen” you put your API to “production”.
However, I now get the error
No TTS service can be found for voice googletts:deDEStandardA
it looks like your authentication didn’t go through. Or - and that’s a problem I’m having - it went missing again.
For me, after a week or so, suddenly my Google voice will become silent and I need to authenticate again.
I retrieved the auth code, edited the OH page and saved it again:
2021-03-01 10:18:25.555 [DEBUG] [.googletts.internal.GoogleTTSService] - Updating configuration
2021-03-01 10:18:25.560 [TRACE] [.googletts.internal.GoogleTTSService] - New configuration: GoogleTTSConfig{pitch=0.1, speakingRate=1.0, volumeGainDb=0.0, purgeCache=false}
2021-03-01 10:18:25.561 [DEBUG] [ce.googletts.internal.GoogleCloudAPI] - Trying to get access and refresh tokens.
2021-03-01 10:18:25.570 [DEBUG] [oauth2client.internal.OAuthConnector] - Oauth request parameter grant_type, value authorization_code
2021-03-01 10:18:25.571 [DEBUG] [oauth2client.internal.OAuthConnector] - Oauth request parameter code, value 4/1AY0e-g5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXzbsT1JNbAp_8
2021-03-01 10:18:25.572 [DEBUG] [oauth2client.internal.OAuthConnector] - Oauth request parameter redirect_uri, value urn:ietf:wg:oauth:2.0:oob
2021-03-01 10:18:25.572 [DEBUG] [oauth2client.internal.OAuthConnector] - Setting authentication for clientId 812xxxx4617XXXXXXXX5trg0vm1m01omo.apps.googleusercontent.com. Using basic auth false
2021-03-01 10:18:25.932 [DEBUG] [oauth2client.internal.OAuthConnector] - grant type authorization_code to URL https://accounts.google.com/o/oauth2/token success
2021-03-01 10:18:25.939 [DEBUG] [lient.internal.OAuthStoreHandlerImpl] - Decrypting token: AccessTokenResponse [accessToken=2coIXXXXXXXXAoCe+EuN08QaEZpmKWnJt1HG/TtHZhXXJ8Wvc/Ws5Xx0zCRaTyPXTMQXXXXXXXXXXXX, tokenType=Bearer, expiresIn=3599, refreshToken=qMSIzXXXXX8twY=, scope=https://www.googleapis.com/auth/cloud-platform, state=null, createdOn=2021-03-01T10:18:25.931931]
2021-03-01 10:18:26.210 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: undefined
2021-03-01 10:18:26.235 [TRACE] [.googletts.internal.GoogleTTSService] - Initializing voices
2021-03-01 10:18:26.236 [TRACE] [.googletts.internal.GoogleTTSService] - Initializing audio formats
2021-03-01 10:18:26.237 [WARN ] [.googletts.internal.GoogleTTSService] - Audio format OGG_OPUS is not yet supported.
2021-03-01 10:18:26.237 [TRACE] [.googletts.internal.GoogleTTSService] - Audio format not supported: OGG_OPUS
2021-03-01 10:18:26.238 [TRACE] [.googletts.internal.GoogleTTSService] - Audio format supported: MP3
2021-03-01 10:18:26.239 [TRACE] [.googletts.internal.GoogleTTSService] - Audio format supported: LINEAR16
2021-03-01 10:18:26.243 [DEBUG] [.googletts.internal.GoogleTTSService] - Updating configuration
2021-03-01 10:18:26.244 [TRACE] [.googletts.internal.GoogleTTSService] - New configuration: GoogleTTSConfig{pitch=0.1, speakingRate=1.0, volumeGainDb=0.0, purgeCache=false}
2021-03-01 10:18:26.245 [DEBUG] [lient.internal.OAuthStoreHandlerImpl] - Decrypting token: AccessTokenResponse [accessToken=2coI0AFwRAzTMQ09b9muWW13W08hjjtihoqOdq18bhgC3tfH, tokenType=Bearer, expiresIn=3599, refreshToken=qMSIza061SpDrt1HaY2z9Gio+Y1jCccWuR/4lSxytLVsqqgmWK2HbXOf7548twY=, scope=https://www.googleapis.com/auth/cloud-platform, state=null, createdOn=2021-03-01T10:18:25.931931]
2021-03-01 10:18:26.289 [TRACE] [.googletts.internal.GoogleTTSService] - Initializing voices
2021-03-01 10:18:26.291 [TRACE] [.googletts.internal.GoogleTTSService] - Initializing audio formats
2021-03-01 10:18:26.292 [WARN ] [.googletts.internal.GoogleTTSService] - Audio format OGG_OPUS is not yet supported.
2021-03-01 10:18:26.293 [TRACE] [.googletts.internal.GoogleTTSService] - Audio format not supported: OGG_OPUS
2021-03-01 10:18:26.293 [TRACE] [.googletts.internal.GoogleTTSService] - Audio format supported: MP3
2021-03-01 10:18:26.294 [TRACE] [.googletts.internal.GoogleTTSService] - Audio format supported: LINEAR16
which to me looks good.
then I am issueing a say-command like so
say(“Hi”,“googletts:deDEStandardA”,“chromecast:chromecast:686668768768767ed035d702f3fd4a6”, new PercentType(50))
and I get
2021-03-01 10:34:09.767 [WARN ] [core.voice.internal.VoiceManagerImpl] - Error saying 'Hi': No TTS service can be found for voice googletts:deDEStandardA
org.openhab.core.voice.TTSException: No TTS service can be found for voice googletts:deDEStandardA
The “Default Voice” field should be a selection list of all voices that can be selected for your tts service (Google). Can you confirm you get a list of voices when you click on it?
Did you use “Desktop” as application as described earlier in this thread?
It looks like your authentication goes through, but it is not able to connect to the Google tts service…
After some digging and following the different links in the binding documentation, I have noticed a message on the top of one of the pages saying that my trial or demo period was over (I don’t remember the exact wording). After I confirmed that I want to proceed with a “full account” it started to work again after I had created a new Authorization Code for the binding.
And guess what, surprise, I can select the Language in der Voice Field mentioned above which is filled with what was retrieved from Google and shown in the logs!
It also shows in the logs that it creates the sound
2021-03-01 18:49:38.465 [DEBUG] [.googletts.internal.GoogleTTSService] - Synthesize ‘Hallo Welt’ for voice ‘googletts:deDEStandardA’ in format AudioFormat [codec=MP3, container=NONE, bitDepth=16, bitRate=64000, frequency=44100]
and I can find the mp3 in the cache folder.
So the text-to-speech problem is solved. However, sigh, it is not played back.
So, I went further and for those who do have the same problem: the chromecast binding contains a callback URL which MUST point back to the openhab-URL (in my case because I have migrated from OH2 to OH3 the ip address had changed, so the URL became wrong!). So I changed it now everything is working.
…all’s well that ends well
Thanks to you, Matt and Bob for the support!
Stefan
Good find! I wonder if you experience the same as me - having to re-authenticate every few weeks. Please let me know if that’s the case, right now I haven’t looked into it too much…
I just had to reauthenticate again yesterday, I think 2 weeks after my initial authentication. Previously my application was Tv and limited input, now i tried desktop app.
Interesting! Thanks for the feedback - so it seems I’m not the only one! Two weeks also match what I’m experiencing!
Maybe there’s a setting in the google dev console that could prevent this?