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

I am so happy, I have searched a long time for a solution to let alexa speak anything what I want, and now I found the solution!
In the past, I found solutions with hacking an alexa remote or creating a MP3 with the amazon services which will be streamed with bluetooth. But I was not really happy with this solutions. Another possibility was the reminder feature, but there was a big disadvantage with this, because there was always a intro with ‘I remind you’ followed by the supplied text.
But now amazon have provided a new routine feature where a user can define a custom text to speak. And because my amazonechocontrol binding supports already starting a routine by using the preview feature, it was easy to use this feature now for TTS.

It’s very simple now that a amazon echo device speaks a text triggered by a rule:

rule "Say welcome if the door opens"
when
    Item Door_Contact changed to OPEN
then
    Echo_Living_Room_TTS.sendCommand('Hello World')
end

The only thing what you need is to install the current release candidate of my binding which can be downloaded for OH2.2 from the marketplace or download it manually (OH2.2, OH2,3) from my amazonechocontrol thread.

I hope now, that one of the openHAB maintainer (@Kai, @martinvw) find the time to finish the review of my pullrequest before the OH 2.3 is released, so that the binding will be part of the official distribution.

Btw, if there is anybody a native english speaker and want help me to provide a more perfect readme text, I’ am happy for any suggestion.

14 Likes

Hi Michi,

I just wanted to express my thankfullness for the ammount of time and effort you’ve put into this binding.
The outcome is a tremendous piece of work and I understood the above can be viewed as world’s first within the home automation space?

thanks again I’m going to try it out right away.

Kurt

1 Like

is this compatible with Australia / New Zealand?

we have the binding setup and the amazon account thing says online but our echo and our dot both say offline.

any ideas how to get them working?

1 Like

Which domain did you use? Is it the same which you use with the alexa web page? Then it should work.

got it working, in paperui the amazon.com.au is not an option from the dropdown menu so I was using amazon.com. after manually typing amazon.com.au everything started to work.

thanks for your help.

I just wanted to chime in on this and say Thanks!!!
This is wonderful.

I was having some issues with the example rule, and needed " " instead of ’ ’ around the desired message to
speak in order for my device to output my “Door was opened” message.

Just in case this might help someone else in the same boat.

1 Like

Hi, is TTS supposed to work in Spain? I am testing it and Alexa responds “Sorry I couldn’t find what you asked for” (in Spanish) whenever I send a TTS command. I am using version 2.4.0.201811041600 of the binding.

Thanks

When the language to is set to English TTS works. It seems only reminders work in Spanish. Any way to know when Amazon will have TTS working in Spanish?

I tried setting this up here (I’m located in the US) and am unable to get past step 3b of First Steps. I tried logging in at the URL on my OH2 instance, but after successfully logging in per step 3b from the README, amazon complains as follows:


Bridge thing status is unchanged:

amazonechocontrol:account:account1 (Type=Bridge, Status=OFFLINE (CONFIGURATION_PENDING): Please login in through web site: http(s)://<YOUROPENHAB>:<YOURPORT>/amazonechocontrol/account1, Label=Karns Amazon Account, Bridge=null)

I am running openHAB 2.4.0~20181115123158-1 (Build #1425). I manually copied org.openhab.binding.amazonechocontrol_2.4.0.201811041600.jar to /usr/share/openhab2/addons. I enabled DEBUG logging for the binding, but no errors or warnings appear in the log when I sign on to my Amazon account.

I just saw that you (@michi) released Beta 2.4 (7) Version, which I installed – all is good here, thank you.

textToSpeech appears to be broken. :confused:

org.openhab.binding.amazonechocontrol:2.4.0.201811251726
same exception with
org.openhab.binding.amazonechocontrol:2.4.0.201811161948

  `Echo_Office_TTS.sendCommand('Hello world')`

POST url ‘https://alexa.amazon.com/api/behaviors/preview’ failed: Bad Request

In a browser returns: <UnknownOperationException/>

2018-11-28 11:30:23.876 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@db8d120': 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:521) ~[?:?]
        at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNode(Connection.java:1038) ~[?:?]
        at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommand(Connection.java:1023) ~[?:?]
        at org.openhab.binding.amazonechocontrol.internal.Connection.textToSpeech(Connection.java:1014) ~[?:?]
        at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.startTextToSpeech(EchoHandler.java:640) ~[?:?]
        at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.handleCommand(EchoHandler.java:527) ~[?:?]
        at sun.reflect.GeneratedMethodAccessor130.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) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
        at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
        at com.sun.proxy.$Proxy224.handleCommand(Unknown Source) [190:org.openhab.binding.amazonechocontrol:2.4.0.201811251726]

Hi, unfortunately does it work in my installation. But I have heard from another user that he had the same problem. The error was, that he had two accounts. The tts does only work for the first account where it was bought. It seems that amazon have changed something, so that this configuration does not work anymore.
Btw, in which amazon domain is your account?
Michael

@michi, I think you’re on to something.

I just changed the Echo I tested with and the textToSpeech did indeed work. Awesome!

You’re correct, the first Echo (not working) that I configured is registered through my Amazon account which is a Family sub account on my wife’s Prime account. So even though the device shows in the my.local.openhab:8080/amazonechocontrol/ listing, it is associated to my account and must not be accessible.

I’m in the US, so amazon.com is selected.

@michi

I just added a Second Amazon Account Thing and switched the Bridge Selection on the existing non working Thing, and now it is working.

Note that all devices show in both of my.local.openhab:8080/amazoncontrol/ listings.

Hum… Spoke too soon. Appears that maybe Two Alexa Accounts cannot be defined at the same time. Now seeing a Handler Warning too.

[WARN ] [.core.thing.binding.BaseThingHandler] - Handler EchoHandler tried updating the thing status although the handler was already disposed.

Have to tried to restart OH? Two accounts should not be a problem, I use 3 for my testings.

Hi Michael

Can TTS be used with a group to send text to all echos at once?

Thanks!

Yes, create a group on your TTS items and then send a command like this.

Alexa_TTS_Alerts.sendCommand(‘message’)

Best, Jay

I’ve been using two accounts for 3 months now w/o issues.

Best, Jay

So TTS_Alerts is a new channel? I cant see if anywhere…

Nope, Alexa_TTS_Alerts is my group name on the item TTS level.

String Echo_Living_Room_TTS                   "Text to Speech"                       (Alexa_TTS_Alerts) { channel="amazonechocontrol:echo:account1:echolivingroom:textToSpeech" }

Best, Jay

1 Like