Release Candidate and Support: Amazon Echo Control Binding

Switching to beta 7 has resolved this issue for me, thanks for the great work!

1 Like

Thanks for this great Binding.

If I understand correctly the start command is limited to the following: Weather, Traffic, GoodMorning, SingASong, TellStory, FlashBriefing.

I was wondering if it is possible to extend it to other commands like for example “show my photos” or if there is another option to send such command?

Thanks
Régis

so am I getting it right (as the statements here are quite different) that this binding (or the Alexa api) does NOT support Alexa TTS on third party devices (like on Sonos One) yet?

At least I am not getting it to be working.
I’ve grouped two Sonos devices and one echo dot. and when I am sending a tts command only the echo dot is talking.

Is there an easy way to implement a simple ON/OFF switch for an Echo? I know, that I can use a dummy-item and a set of rules for that - but I’d like to go without rules.
Any idea is appreciated! :slight_smile:

Cheers, Flo

I have the same problem,did not found a cause yet, hope @michi can help?

Hi Michael, @michi

am wondering if you might be able to help with the following - ive recently updated to openhab 2.4 and am having great difficulty with the echo binding - when attempting to sign into my amazon account im getting the following error

HTTP ERROR 500
Problem accessing /amazonechocontrol/7575928e/ap/signin. Reason:

Server Error

Caused by:
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 8 column 1 path $
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
at com.google.gson.Gson.fromJson(Gson.java:887)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.google.gson.Gson.fromJson(Gson.java:801)
at com.google.gson.Gson.fromJson(Gson.java:773)
at org.openhab.binding.amazonechocontrol.internal.Connection.parseJson(Connection.java:817)
at org.openhab.binding.amazonechocontrol.internal.Connection.registerConnectionAsApp(Connection.java:658)
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.handleProxyRequest(AccountServlet.java:630)
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doVerb(AccountServlet.java:225)
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doPost(AccountServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:531)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 8 column 1 path $
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
… 44 more
Caused by:
java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 8 column 1 path $
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
at com.google.gson.Gson.fromJson(Gson.java:887)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.google.gson.Gson.fromJson(Gson.java:801)
at com.google.gson.Gson.fromJson(Gson.java:773)
at org.openhab.binding.amazonechocontrol.internal.Connection.parseJson(Connection.java:817)
at org.openhab.binding.amazonechocontrol.internal.Connection.registerConnectionAsApp(Connection.java:658)
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.handleProxyRequest(AccountServlet.java:630)
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doVerb(AccountServlet.java:225)
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doPost(AccountServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:531)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680)
at java.lang.Thread.run(Thread.java:748)
Powered by Jetty:// 9.4.11.v20180605

Howdy fellow openHAB users/Echo owners! I try to regularly glance at this thread to stay informed of new features and to learn how others have been using this extremely awesome control binding. I just wanted to note a few additional options/routes by which one can implement many of these Echo device features into one’s own home that I don’t believe I’ve seen anyone specifically document on here (please forgive me if I’m wrong and not sharing anything particularly useful here, lol).

This control binding also works with Amazon Fire Tablets as well as the free Alexa for PC Amazon/Microsoft Store Windows app. The “lastvoicecommand” parameters, TTS/Speak controls, and many others work if you add your Fire Tablet or Alexa for PC Windows app as Echo Dot devices. I believe I tried adding the Fire Tablets as Show devices and was also able to make things work but I haven’t really taken the time to see exactly which features work best for each device type.

Anyway, if you have Fire Tablets implemented into your IoT/“Smart Home” setup, say as home information display/control screens, you can use them to broadcast TTS, play music (not directly through the music command control but using something like Tasker/AutoNotification/Join to pickup on commands and respond with music/video/whatever playback), etc. The TTS output on the Fire Tablets is not quite in sync with the Echo Dot TTS broadcasts (I use a “Speak_Everywhere” item for whole-house TTS PA announcements, linked to the Speak control item on each Echo Device) but is about one second behind my Dots, but it still works well.

And with the Alexa for PC Windows App cloaked as a “Dot,” you can now use any old PC as an “Echo”/Alexa device, either standalone or in tandem with your other real Echo devices. The app setup also allows for Alexa voice input control (via lastvoicecommand) as you would with a regular Dot. Another useful little trick here: Amazon annoyingly blocks “wake word” functionality on Alexa for PC devices (I assume mostly because they want you to buy one of the official “Alexa Built-in” devices they’ve put their OEM stamp-of-legitness on through their branding partnerships with several hardware manufacturers), but this is easy to bypass with a simple AutoHotKey voice recognition or Rainmeter script - and you can have Alexa “wake up” with any word you would like, and not just the typical “Alexa”/“Echo”/“Amazon”/“Computer” wake word options. If anyone would like to see an example script/might find it helpful, just let me know and I’m happy to share what I’ve tested and used.

Hopefully someone out there will find this info useful! :slight_smile: If all I’ve only managed to accomplish here has been to waste a few minutes of your time, I do apologize in advance! :stuck_out_tongue: :man_shrugging:t2:

4 Likes

If this helps: here’s a screenshot of my http://localhost:8080/amazonechocontrol/ Amazon Account thing page, showing all the “Alexa” devices connected under my account. The devices notated with the ➤ symbol are my actual Dots. As you can see - there are many possible ways to connect many different Alexa devices/interfaces into your openHAB system, through this control binding - you just need the device’s serial number. I’d really be curious to learn more about what devices and what various device features can be connected in this way.

1 Like

is this available for the us only ? my alexa account is us. But my microsoft account is canadian

1 Like

ok had to change the language setting

1 Like

so I also can see the list of echo devices on my account and also the state of each of them (online/Offline) is there a way to return the state of a specific device by http url call?

Thanks
Paul

I would be interested to try your script to allow the wake word

just thought about this some more and I guess I am just asking for a channel that exposes the state of the echo device has this already been done if so whats the channel?
Thanks
Paul

I was going to say, I believe there are ways you can get around regional limitations/change your settings. Hopefully it’s working for you :slight_smile:

1 Like

Hi Thanks for the info.
I was interested when you say you make announcements to multiple Dots - i cant do this because the binding stops working.
I’ve tried put the dots speak into a group but that also fails.
Interested if you may have a work around for this ?

I have mine in a group a group and sometimes there are errors in the log and one or other member of the group fails to make the announcement. It seems to be a random event.


org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.de/api/behaviors/preview' failed: Bad Request

	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:593) ~[?:?]

	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNode(Connection.java:1140) ~[?:?]

	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNodes(Connection.java:1149) ~[?:?]

	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommandWithVolume(Connection.java:1113) ~[?:?]

	at org.openhab.binding.amazonechocontrol.internal.Connection.textToSpeech(Connection.java:1089) ~[?:?]

	at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.startTextToSpeech(EchoHandler.java:738) ~[?:?]

	at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.handleCommand(EchoHandler.java:586) ~[?:?]

	at sun.reflect.GeneratedMethodAccessor505.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) [102:org.eclipse.smarthome.core:0.10.0.oh240]

	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [102:org.eclipse.smarthome.core:0.10.0.oh240]

	at com.sun.proxy.$Proxy145.handleCommand(Unknown Source) [259:org.openhab.binding.amazonechocontrol:2.5.0.Beta_06]

	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [109:org.eclipse.smarthome.core.thing:0.10.0.oh240]

	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [109:org.eclipse.smarthome.core.thing:0.10.0.oh240]

	at sun.reflect.GeneratedMethodAccessor504.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) [102:org.eclipse.smarthome.core:0.10.0.oh240]

	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.10.0.oh240]

	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) [?:?]```

I get also the same error randomly:

23:56:35.325 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org                                                     .openhab.binding.amazonechocontrol.internal.handler.EchoHandler@1692fb49': POST url 'https://alexa.amazon.fr/api/behaviors/preview' failed:                                                      Bad Request
org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.fr/api/behaviors/preview' failed: Bad Request
at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:593) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNode(Connection.java:1140) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommand(Connection.java:1125) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommandWithVolume(Connection.java:1116) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.sendAnnouncement(Connection.java:1082) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.startTextToSpeech(EchoHandler.java:736) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.handleCommand(EchoHandler.java:586) ~[?:?]
at sun.reflect.GeneratedMethodAccessor218.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.ec                                                     lipse.smarthome.core:0.10.0.oh240]
at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [102:org.eclipse.smarthome                                                     .core:0.10.0.oh240]
at com.sun.proxy.$Proxy155.handleCommand(Unknown Source) [191:org.openhab.binding.amazonechocontrol:2.5.0.Beta_05]
at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [109:org.eclips                                                     e.smarthome.core.thing:0.10.0.oh240]
at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [109:org.                                                     eclipse.smarthome.core.thing:0.10.0.oh240]
at sun.reflect.GeneratedMethodAccessor217.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.ec                                                     lipse.smarthome.core:0.10.0.oh240]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.10.0.oh240]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
at java.lang.Thread.run(Unknown Source) [?:?]

It seems that the player in the echo goes offline. Please try the new channels:

  1. Set “musicProviderId” the id of your radio provider. e.g. “TUNEIN” (You will find the full list of ids on the account web page.
  • Open the binding website:
  • http://<youropenhab>/amazonechocontrol
  • Navigate to your account
  • Click on the echo device
  1. Set a string with the name of your favorite station to the channel “playMusicVoiceCommand” It should be namedin the way how you can start it with your voice, eg. “Hitradio Ö3”

Hi, you have to use the beta version of this thread in the top most posting or a 2.5 beta.

Hi,

Thank you @richaardvark for all your use-full information.

Just some background information to the binding. The things (e.g. echo, echoShow, wha…) only differs in the provided channels. Currently the echoshow supports all channels. The api calls are the same for all devices.
If someone test ALL channels on an unsupported device and give me feedback which are working, I could implement a own thing type for that.

Best,
Michael