Google TTS addon for OH2

Thanks for the Info, I can confirm that this works:

org.openhab.voice.googletts:serviceAccountKey=[JSON CONTENT]

would it be possible to adjust these configuration settings temporarily through rules?

org.openhab.voice.googletts:serviceAccountKey=[JSON CONTENT]
1 Like

Hi @maurits_irizarri_van,

as far as I understand rules only have access to items. If the binding does not provide a channel to access the properties/information, I don’t think that you can use them in rules. (GoogleTTS does not provide such a channel)

1 Like

I was so far using MaryTTS and wanted to switch to GoogleTTS. I did follow the installation instruction (including the billing part).
I installed the google voice addon and configured it accordingly. After selecting Google voice as default text to speach in configuration I was not able to select the google voices (just the Mary TTS voices were listed). I tried to uninstall google voice addon and MaryTTS and restart openhab and just installed the google voice addon. Now I can’t even select google TTS as default text to speach under configuration anymore even after a openhab restart. I installed MaryTTS again and I can select it as always. Any ideas what I could try?

I am on OpenHab 2.4.0 stable release.


Update: Found the problem. I enabled the google cloud api assuming this would include the tts api. Thats not the case so the tts api has to be enabled explicitly.

same problem here , i use voicerss in place , i’m on 2.5m5

Anyone else experiencing the following error after upgrading to 2.5 stable?

2019-12-16 19:48:10.354 [ERROR] [org.openhab.voice.googletts ] - bundle org.openhab.voice.googletts:2.5.0 (327)[org.openhab.voice.googletts.internal.GoogleTTSService(411)] : The activate method has thrown an exception
java.lang.VerifyError: Bad type on operand stack
Exception Details:
com/google/auth/oauth2/OAuth2Utils.()V @31: putstatic
Type ‘com/google/api/client/http/javanet/NetHttpTransport’ (current frame, stack[0]) is not assignable to ‘com/google/api/client/http/HttpTransport’
Current Frame:
bci: @31
flags: { }
locals: { }
stack: { ‘com/google/api/client/http/javanet/NetHttpTransport’ }
0x0000000: 1229 b800 2ab3 002b 122c b800 2ab3 002d
0x0000010: 122e b800 2ab3 002f bb00 3059 b700 31b3
0x0000020: 0032 bb00 3359 b700 34b3 0035 b800 36b3
0x0000030: 0006 1237 b800 38b3 0039 123a b300 1012
0x0000040: 3bb3 0015 b1

at ~[?:?]

@wborn @gbicskei

Is this something you could look at to see if it is 2.5 related?

I gave it a test and with openHAB 2.5 the Google TTS add-on works fine for me on an Intel NUC and Raspberry Pi 3B.

Since the exception is spitting bytecode and talking about operands on stacks the issue seems low level. Maybe its due to file/memory corruption or some JVM issue? What Java version do you use?

I submitted a new version for the Google TTS add-on recently - If you like you can give it a try - *.jar file for testing is attached on GitHub:

  • Refactored to use openHAB Core OAuth2 -> Removed dependencies on Google libraries

For authentication I replaced the serviceAccountKey configuration parameter by clientId, clientSecret and the one-time required authcode .

I am using the docker image, maybe the java version inside the docker image is not compatible?

I will try this one, but first need to figure out again how that replacing with a snapshot version works;)

I’m using the Debian based Docker images and they work fine for me. Do you use the Alpine or Debian images?

Im using version 2.5 of Im not specifying a distro so I think it will default to Debian:

debian for Debian 10 “buster” (default when not specified in tag)

The default image is indeed based on Debian.

What architecture are you using? You can check that on the command line using: uname -i

Are you sure you’re using the add-on part of OH 2.5 and not some JAR in the /addons directory?

It should show 2.5.0 on the Console when issuing

openhab> bundle:list -s | grep googletts
273 │ Active │  80 │ 2.5.0                   │ org.openhab.voice.googletts

Does anyone know if the addon caches the voice? Just like VoiceTSS does (with the bad quality)

So for example, i send “The alarm has been swiched on” to Google. Google sends a wavefile back and openhab saves the file and uses it again the next day when the alarm has been switched on. So this will cost only one time the characters.

This is because of the billing, i’m not jumpy about giving my credit card data to google with the risk, something went wrong with the speech engine and i will be billed… It’s just hobby :slight_smile:

This is for example already 79 chars (in stead of 18 you will expect):

<speak>  <say-as interpret-as="cardinal">12345</say-as> and one more</speak>

Yes, it does. The add-on stores MP3 files on your local disc. You can find them in $OPENHAB_USERDATA/cache/org.openhab.voice.googletts/.

I will add a note to the docs.

1 Like

I have been using Google TTS alot for long. I have never had a bill. And because it do cache the voice, I doubt any “ordinary” people/family would ever reach the limit.

But nobody can say for sure if Google some day change the limit…

1 Like

Thnx guys! I installed it and added the billing info. The project has a nice dashboard so I can monitor the usage.

The voice is really good, wavenet is even better!

Where did you find the dashboard?

I install this version and I have no more error like here : Google Calendar Scheduler - No instructions in log file (conflit with gcal binding).
I clean the cache and enter OAuth2 parameters. Everything seems to be ok.

2020-01-24 15:05:15.385 [INFO ] [oauth2client.internal.OAuthConnector] - grant type authorization_code to URL success
2020-01-24 15:05:15.544 [WARN ] [.googletts.internal.GoogleTTSService] - Audio format OGG_OPUS is not yet supported.
2020-01-24 15:05:15.591 [WARN ] [.googletts.internal.GoogleTTSService] - Audio format OGG_OPUS is not yet supported.

But I can’t choose voice :

 voice voices
An unexpected error occurred during execution.

and log :

15:09:26.903 [ERROR] [] - An error occurred while executing the console command.
java.util.NoSuchElementException: null
        at java.util.ArrayList$ ~[?:1.8.0_242]
        at org.eclipse.smarthome.core.voice.internal.VoiceManagerImpl.getPreferredVoice( ~[?:?]
        at org.eclipse.smarthome.core.voice.internal.VoiceConsoleCommandExtension.getDefaultVoice( ~[?:?]
        at org.eclipse.smarthome.core.voice.internal.VoiceConsoleCommandExtension.execute( ~[?:?]
        at [bundleFile:?]
        at [bundleFile:?]
        at [bundleFile:4.2.7]
        at [bundleFile:4.2.7]
        at org.apache.felix.gogo.runtime.Closure.executeCmd( [bundleFile:4.2.7]
        at org.apache.felix.gogo.runtime.Closure.executeStatement( [bundleFile:4.2.7]
        at org.apache.felix.gogo.runtime.Closure.execute( [bundleFile:4.2.7]
        at org.apache.felix.gogo.runtime.Pipe.doCall( [bundleFile:4.2.7]
        at [bundleFile:4.2.7]
        at [bundleFile:4.2.7]
        at [?:1.8.0_242]
        at java.util.concurrent.ThreadPoolExecutor.runWorker( [?:1.8.0_242]
        at java.util.concurrent.ThreadPoolExecutor$ [?:1.8.0_242]
        at [?:1.8.0_242]

I’m using OH 2.5 and zulu-8 (