openHAB can now use Amazon Echo devices to speak any text (TTS) - new feature in the amazonechocontrol binding

Thanks! That seems to work :slight_smile:

Only issue I’m experiencing with calling multiple Echos as a group is; if I call the group back to back (even with 10 seconds between the calls); the binding blows up. Tried it numerous times.

Maybe calling 11 Echo’s is a bit too much?

2019-01-25 15:51:13.224 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@74624bf8': POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Bad Request
org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Bad Request
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:586) [187:org.openhab.binding.amazonechocontrol:2.5.0.Beta_03]
	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNode(Connection.java:1124) [187:org.openhab.binding.amazonechocontrol:2.5.0.Beta_03]
	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNodes(Connection.java:1133) [187:org.openhab.binding.amazonechocontrol:2.5.0.Beta_03]
	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommandWithVolume(Connection.java:1097) [187:org.openhab.binding.amazonechocontrol:2.5.0.Beta_03]
	at org.openhab.binding.amazonechocontrol.internal.Connection.textToSpeech(Connection.java:1073) [187:org.openhab.binding.amazonechocontrol:2.5.0.Beta_03]
	at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.startTextToSpeech(EchoHandler.java:717) [187:org.openhab.binding.amazonechocontrol:2.5.0.Beta_03]
	at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.handleCommand(EchoHandler.java:600) [187:org.openhab.binding.amazonechocontrol:2.5.0.Beta_03]
	at sun.reflect.GeneratedMethodAccessor167.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [99:org.eclipse.smarthome.core:0.10.0.201805151356]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [99:org.eclipse.smarthome.core:0.10.0.201805151356]
	at com.sun.proxy.$Proxy210.handleCommand(Unknown Source) [187:org.openhab.binding.amazonechocontrol:2.5.0.Beta_03]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [106:org.eclipse.smarthome.core.thing:0.10.0.201805151356]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [106:org.eclipse.smarthome.core.thing:0.10.0.201805151356]
	at sun.reflect.GeneratedMethodAccessor166.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [99:org.eclipse.smarthome.core:0.10.0.201805151356]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [99:org.eclipse.smarthome.core:0.10.0.201805151356]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]

Best, Jay

Works great with a single echo. The group also works, but the voice output is not syncronous - or is there a solution that the speakers really all talk at the same time?

Question:
Thing echo works on ECHO und ECHOSHOW.
Thing echoshow doesnt work at all … or do I have to change anything else (in the items for example)?

No, please take a look in this posting
for more details.

No, the only difference is the type, please check your thing file again, maybe the serial is wrong. Do you see the thing in PaperUI?
You can also try to use the echo thing for echo show devices, currently is no difference, but this may change in the future.

1 Like

Now it is working with an an “EchoShow”-item

I changed in the amazonechocontrol.items the channel definition from …

{channel="amazonechocontrol:echo:account1:echo_sz:textToSpeech"}

to

{channel="amazonechocontrol:echoshow:account1:echo_sz:textToSpeech"}

For me this part is missing in the full example here:

However, thx for your help.

The examples given in the document are ALL from a single Echo thing. You missed to read:

Sample for the Thing echo1 only. But it will work in the same way for the other things, only replace the thing name in the channel link.

After defining a thing (with a .things file or via PaperUI) you can copy the correct channel Syntax from PaperUI!

Maybe reading was the problem …

In the documentation:
"Sample for the Thing echo1 only. But it will work in the same way for the other things, only replace the thing name in the channel link. "

Only the thing name?
No - that was the problem - you have to change thing name AND the thing type.

However, my note what just a suggestion to make it easier for other users.

Do we know if this works with the Sonos ONE with built in Alexa? My understanding Sonos only has limited Alexa API support and some things don’t work in general.

Thanks.

JR

Thank you for the hard work
after spending a lot of time, i found this post and finally manage to get alexa to speak for me :slight_smile:

I don’t have a SONOSONE to test, but I do have a BEAM that I got working.
This is what I did it to get it working.

  1. Go to the http://openhab:8080/amazonechocontrol/
  2. Get the serial number for the sonos enabled Alexa you want to setup.
  3. Go in PAPERUI and then INBOX, click the big + sign, Select AMAZON ECHO CONTROL BINDING. Click ADD MANUALLY. click on AMAZON ECHO. Select your Bridge then paste in the Serial Number.

Your mannually added Alexa enabled Sonos’s name will be shorter then the rest, but mine still worked. After that you just have to create the items like below and make/call it a rule.

String 		Echo_TV_Room_TTS				"TV Room Text to Speech [%s]"			(gTVRoom_EchoDot)		{channel="amazonechocontrol:echo:AlexaTVRoom:textToSpeech"}
Dimmer 		Echo_TV_Room_TTS_Volume			"TV RoomText to Speech Volume [%s]"		(gTVRoom_EchoDot) 		{channel="amazonechocontrol:echo:AlexaTVRoom:textToSpeechVolume"}

Hopefully this helps!

Hi Michi and everyone,

Greeting from Switzerland.

I have installed your binding and configured the Amazon account and all Amazon things are showing up in Paper UI and Habmin.

However when I create a rule it does not show me the option to play the message through the Alexa Echo device.

Could you guide me on how to do it?

For the m0ment i just want to achieve that when there is a Vibration in a Samsung Multi Sensor then Alexa should play a Welcome message on a Particular Echo Dot in the account.

Please advise.

Regards
Sajive Trehan

Is this in PaperUI for the Echo Dot thing?

Did you click “Show More” in the Channels section? (There’s a second page and the speech channel is there).

Is that what you meant?

Sehr geehrter Tom

Thanks for your answer.

With your inputs I am able to control the Echo Speaker from the Paper UI and make it “Speak” custom commands from the Paper UI control interface.

However still when I create a rule and say “say something” i cant find Echo as a “sink” there. Or is there a different way to make it speak a message from a rule?

Your help in getting this configured will be highly appreciated.

I await your update.

Vielen Dank für Ihre Kenntnisnahme
Freundliche Grüsse

TREHAN Sajive

I’m not sure what you want to do here. Do you want to say something to your Echo to trigger an openHAB rule, or something else?

Thanks for your answer.

I have a door sensor and I want Alexa to play a custom Welcome Message when the door sensor opens.

Would appreciate your help.

Something like this:

Items. Door contact and Text to Speech item

Contact Door_Sensor "Door sensor"    { xxxxx }

String EchoTTS   "Text to speech"    { channel="amazonechocontrol:echo:xxxxxxxxxxxxxx:textToSpeech" }

Rule:

rule "welcome"

when
	Item Door_Sensor changed to CLOSED
then
	sendCommand(EchoTTS, "Welcome home. Please start cooking the dinner")	
end

Thanks Tom,

I appreciate your inputs.

However till now I have only used the Paper UI to make rules and havent used the scripts.

Can you guide me or direct me to some how to on doing these rules with scripts.

I will highly appreciate the same.

Regards

The rule given by @Saracen is a good example, just replace the item names with the corresponding ones you are using and you are good to go. The rule needs to be saved as a .rules file in the rules folder.
What else do you need?

Thanks for the help.

Which folder and full filename can i find the rules files.
Sorry for my ignorance as till now i have used only the Web UI.

Regards

Reading the Rules Documentation would give you
Rules are placed in the folder $OPENHAB_CONF/rules .

The files can be named as you want, the ending must be .rules.