The binding worked fine, and one month before, probably after some upgrade, I got this error. I tried everything: made new credentials, reinstalled binding, restarted openHab, reboot, etc… After every those moves it working some time and after a while I getting same error:
I not using the Google TTS any more, but I think I was facing this issue last time:
A Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of "Testing" is issued a refresh token expiring in 7 days.
This happens a few hours after OpenHab is restarted. I restart OpenHab, then the “say” command works for ~a couple of hours and then I’m getting this error. So I don’t think this is a problem on Google’s side.
Maybe there is an error indeed, if you look at the addon code inside the synthesizeSpeech method the exceptions AuthenticationException and CommunicationException are handled in the same way, so any of them will toggle the variable initialized to false which causes the service to return that error. I don’t know enough about the addon but that seems like a possible root cause.
Then I would get an warning: “Error initializing Google Cloud TTS service: {}” but I don’t receive it. I’m getting only “Missing service configuration”. I found this warning in GoogleTTSService.java on line 305, because oAuthService becomes to null.
Seems that I looked by error on my fork which is outdated, sorry. Yes the same seems to remain, I was meaning this catch that handles both AuthenticationException and CommunicationException. I see a little weird than the oAuthService has to be disposed in both cases, but maybe there is an explanation for it. (file GoogleCloudAPI.java)
Sorry I miss read the message, yes you will have the warning them.
My only other guess is that it can be happening inside the setConfig method because the service implementation is calling it in the wrong moment. If you can add some debug log there maybe you can catch it.
Edit 2:
I think I found the error it is on the updateConfig method of the service class:
Thanks @Miguel_M.A.D for help. I don’t know if they change something, but after upgrade openHab (12 hours ago) to 4.0.3, I’m not getting that warning anymore. It may be too early to rejoice, but so far everything is working longer than before.
Oh, good to now. I realize my second guess was wrong after reviewing the code again, so I didn’t know what else could be.
Probably a PR that checks the error cause and discard timeout errors could fix the problem.
Also, is that timeout configurable? For me seems a good idea to make it configurable if not.
No, this is not configurable. I think the problem is that I’m using TTS with ChatGPT. And ChatGPT sometimes returns a strange response with hieroglyphs, probably because I use Cyrillic. But anyway timeoutException shouldn’t reset oAuthService. This is a wrong behavior.