Google TTS addon for OH2

If someone’s willing to create a Google Cloud TTS voice add-on, I believe you can use Polly TTS (developed by @hillmanr) as a template:

Good luck!

2 Likes

Did you have found a solution for that. I’ve just upgraded from snapshot 2.2.0 to 2.3.0 and the Google TTS stopped working with the same issue. But it is so much better then VoiceRSS.

1 Like

even im facing the issue after upgrading, can some one fix it

Hi,
I’ve created a service implementation that uses the new Google Cloud TTS API. I’ve been using it for a week now without any problems but it would be good to here your feedback as well to improve the solution.

The pull request can be found here, the binary can be downloaded from here and this is the documentation for setup.
Cheers,
Gabor

1 Like

@gbicskei

This is exciting…thank you for taking the time to work on this.

I’ll test this weekend and report back my findings.

Squid

@gbicskei

FYI - The link you have above for the binary returns a 404 error, I have found the following link on the GitHub page.

Download JAR File Here

Does this require 2.4 or will it work on previous OH 2.x versions?

Thanks Again,

Squid

Sorry, I’ve fixed the link. The jar version is 2.4 but I’ve tested it on 2.3

I get an error when adding json file in PaperUI-voice-google_tts settings.

2018-07-13 20:23:24.856 [ERROR] [b.voice.gtts.internal.GoogleCloudAPI] - Error initializing the service using /var/lib/openhab2/gtts/Google Assistant SDK-83f3efb18d22.json

java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available

	at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:256) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:120) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:558) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:551) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.<init>(NettyChannelBuilder.java:489) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:337) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:390) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:206) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:157) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:149) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:151) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at com.google.cloud.texttospeech.v1beta1.stub.GrpcTextToSpeechStub.create(GrpcTextToSpeechStub.java:74) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at com.google.cloud.texttospeech.v1beta1.stub.TextToSpeechStubSettings.createStub(TextToSpeechStubSettings.java:99) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at com.google.cloud.texttospeech.v1beta1.TextToSpeechClient.<init>(TextToSpeechClient.java:128) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at com.google.cloud.texttospeech.v1beta1.TextToSpeechClient.create(TextToSpeechClient.java:109) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at org.openhab.voice.gtts.internal.GoogleCloudAPI.setConfig(GoogleCloudAPI.java:99) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at org.openhab.voice.gtts.internal.GoogleTTSService.updateConfig(GoogleTTSService.java:196) [271:org.openhab.voice.gtts:2.4.0.201807131451]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:229) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:650) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:506) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:307) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:299) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeModifiedMethod(SingleComponentManager.java:772) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.modify(SingleComponentManager.java:727) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:645) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:609) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.configurationUpdated(ConfigurableComponentHolder.java:426) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.RegionConfigurationSupport.configurationEvent(RegionConfigurationSupport.java:284) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.RegionConfigurationSupport$1.configurationEvent(RegionConfigurationSupport.java:89) [32:org.apache.felix.scr:2.0.12]

	at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090) [8:org.apache.felix.configadmin:1.8.16]

	at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058) [8:org.apache.felix.configadmin:1.8.16]

	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]

	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]

	at java.lang.Thread.run(Thread.java:748) [?:?]


@sjef86 what OH version are you using? JDK?

Hi,

I’m running openHAB 2.4.0 Build #1310 on a raspberry pi3 (openhabian)…

[20:43:58] openhabian@openHABianPi:~$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) Client VM (build 25.171-b11, mixed mode)

thanks
Christian

Thanks for working on it! Was hoping it would be available!

@sjef86 Thank you for testing! It is very strange, because I just tried the 2.4.0-SNAPSHOT version, and it works fine. The difference is that I’m using the official docker image which is build #1305 and java 1.8.0_144…

@sjef86 It seems that GoogleCloudPlatform / gRPC doesn’t support Raspberry Pi. Check Supported Platforms. This is the same issue that you have…

@gbicskei

I’ve downloaded the binding you created and placed in my ADDONS folder

I’ve created and downloaded the JSON file through the Google Cloud tool

Started OH and let the GTTS folder get created

Placed the JSON file in the newly created GTTS folder

Went into Paper UI and adjusted the settings in SERVICES > VOICE > GOOGLE TTS SERVICE

Went into Paper UI and selected GOOGLE TTS SERVICE as my default TTS SERVICE

Attempted to look at voices yet NONE of the GOOGLE voices are displayed in my list…they are only the POLLY TTS voices event when GOOGLE TTS is selected.

Went to the OPENHAB.LOG file and found the following:

2018-07-14 14:04:39.915 [ERROR] [b.voice.gtts.internal.GoogleCloudAPI] - Error initializing the service using D:\OpenHab\userdata\gtts\xxxxxxxxxxxxxxxxxxxxx.json
java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
	at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:256) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:120) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:558) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory$DefaultNettyTransportCreationParamsFilterFactory.<init>(NettyChannelBuilder.java:551) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder$NettyTransportFactory.<init>(NettyChannelBuilder.java:489) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:337) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:390) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:206) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:157) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:149) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:151) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at com.google.cloud.texttospeech.v1beta1.stub.GrpcTextToSpeechStub.create(GrpcTextToSpeechStub.java:74) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at com.google.cloud.texttospeech.v1beta1.stub.TextToSpeechStubSettings.createStub(TextToSpeechStubSettings.java:99) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at com.google.cloud.texttospeech.v1beta1.TextToSpeechClient.<init>(TextToSpeechClient.java:128) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at com.google.cloud.texttospeech.v1beta1.TextToSpeechClient.create(TextToSpeechClient.java:109) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at org.openhab.voice.gtts.internal.GoogleCloudAPI.setConfig(GoogleCloudAPI.java:99) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at org.openhab.voice.gtts.internal.GoogleTTSService.updateConfig(GoogleTTSService.java:196) [264:org.openhab.voice.gtts:2.4.0.201807131451]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:229) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:650) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:506) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:307) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:299) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeModifiedMethod(SingleComponentManager.java:772) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.modify(SingleComponentManager.java:727) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:645) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:609) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.configurationUpdated(ConfigurableComponentHolder.java:426) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.manager.RegionConfigurationSupport.configurationEvent(RegionConfigurationSupport.java:284) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.scr.impl.manager.RegionConfigurationSupport$1.configurationEvent(RegionConfigurationSupport.java:89) [42:org.apache.felix.scr:2.0.12]
	at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2090) [7:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2058) [7:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [7:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [7:org.apache.felix.configadmin:1.8.16]
	at java.lang.Thread.run(Thread.java:748) [?:?]

OH VERSION: 2.3 Build 1204
JAVA VERSION: 1.80_161
OS: WINDOWS

Any suggestions??

Squid

@KidSquid
Please make sure your Windows OS is x86_64. It will NOT run on ARM. See supported platforms for details.
If this is OK please turn on TRACE logging on io.grpc:
In OH console:
log:set TRACE io.grpc
Then restart the Google Cloud TTS Service:
bundle:restart Service_ID
and send me the logs. I am looking for the point where the GRPC code is trying to get the default SSL provider in your environment, and it fails for some reason…
Thx

I have done what you’ve requested and attached the log to this post.

Thanks for your assistance.

Squid

@KidSquid
Your Windows is a 32 bit version.

could not load a native library: io_grpc_netty_shaded_netty_tcnative_windows_x86_32

Unfortunately tcnative doesn’t have 32bit builds which is a dependency for Google Cloud Java.

I am running Windows Server which is x64

@KidSquid Check the JDK too? Is it 64 bit as well? The grpc-netty library sees it as x86_32. I’ve added some trace to the service startup, to check this. Download the new binary pls. It is building as I’m writing this…

@gbicskei

Hello -

Sorry for the slow response, real life got in the way! :slight_smile:

I double checked my system and sure enough the JDK I had installed was 32bit, so I have installed the 64 bit version and updated the JAVA_HOME variable to point to the new 64 bit install.

I am still running into issues.

I downloaded the new version of the binding and installed it…in the log I see an error message about the TTS not being enabled on the API, so I click the link provided and enable the TTS.

I then waited quite a bit and still can not seem to get things to work.

As I stated earlier…I see the GOOGLE TTS shows in the SYSTEM display, yet all the voices I see are from POLLY TTS

image

Log File…

https://we.tl/I6pwihWowa