Release Candidate and Support: Amazon Echo Control Binding

Problems here for myself as well (regular US Alexa user, latest binding version). Everything had been working well for months. A few days ago the music commands stopped working - Alexa would say “something went wrong, please try again.”

And today all TTS stopped working, which is very frustrating. :weary: I glanced at my log and think I saw the similar error message posted a few posts up.

I hope we can fix this! :frowning:

What happens if you go to the Amazon Echo Control GUI, eg:

http://your-openhab-ip-address:8080/amazonechocontrol

and click to logout (if necessary) then re-login again? Does that fix the authorization error?

In my case, the relogin doesn’t solve the problem.
Same errors after a lot of tries.

tried that multiple times and also tried to change it from amazon.de to amazon.com or amazon.in etc. - all that did not work

Having the same problem here, it’s giving me an “unauthorized” error. I can’t tell if it worked before because I tried it first time a few days ago.

But @chimera: Where did you find the 2.5RC1 version of the amazon binding? I couldn’t find it. Do you have to build it yourself using maven?

Would you maybe provide your .jar file of the 2.5RC1 verison of the binding so we can test it out as well? I’m actually not that deep into maven and java development myself so it would save me / us a lot of time if you could provide it.

Thank you,
Timo

I have the same problem here. TTS is not working (it is a new setup for this binding). No matter if I successfully relogin through the http://localhost:8080/amazonechocontrol URL or chosing different domains.

It seems to me that something changed and the binding is not working any more with this change.

Could you please help?

Thx,
Bazsa

Timo, click the Home button on your keyboard :wink:

Top of this thread is download link. The first post gets updated as new releases are provided.

Assume you tried “Logout and create new device id” as well?

It’s odd this works for some people, but is failing for others. Go to http://<youropenhab>/amazonechocontrol and make sure it says “Amazon Echo Control RC1” (to confirm you’re on 2.5 RC1) Make sure in PaperUI under Config \ Things, that the Amazon Account and your Amazon devices are showing as online. Other than that, perhaps post the OH version you are running also? That would be the only difference I can think of between various peoples deployments working and not working? Eg, for me this is:

pi@openhab2:~ $ dpkg --list | grep openhab
ii  openhab2                              2.4.0-1                           all          openhab2

I have the same issue with the latest snapshot build #1656. When I try to change the volume, I get the following error:

2019-08-11 11:38:55.514 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@46cd5542': POST url 'https://alexa.amazon.de/api/behaviors/preview' failed: Unauthorized
org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.de/api/behaviors/preview' failed: Unauthorized
at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:648) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNode(Connection.java:1195) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommand(Connection.java:1180) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.handleCommand(EchoHandler.java:433) ~[?:?]
at sun.reflect.GeneratedMethodAccessor109.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) [133:org.openhab.core:2.5.0.201908052317]
at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [133:org.openhab.core:2.5.0.201908052317]
at com.sun.proxy.$Proxy386.handleCommand(Unknown Source) [?:?]
at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [184:org.openhab.core.thing:2.5.0.201908052318]
at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [184:org.openhab.core.thing:2.5.0.201908052318]
at sun.reflect.GeneratedMethodAccessor108.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) [133:org.openhab.core:2.5.0.201908052317]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [133:org.openhab.core:2.5.0.201908052317]
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) [?:?]

Same with other update functions like PLAY, STOP, etc. Strangely, the error does not occur when I adjust the notification volume.

I installed RC1 and created a new device id:

openhab> bundle:list
246 | Active   |  80 | 2.5.0.RC_1            | Amazon Echo Control Binding
openhabian@openhab:~/oh2/etc/openhab2/persistence $ dpkg --list | grep openhab
ii  openhab2                              2.4.0-1                               all          openhab2

Still the same error: Everything is online and items are displayed but writes (e.g. TTS or volume) are not possible:

2019-08-11 12:37:09.232 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@1dc43ba': POST url 'https://alexa.amazon.de/api/behaviors/preview' failed: Unauthorized

Another installation (openhab 2.3.0-1 and binding 2.4.0.2018110416009) using the same account works fine.

I have

[07:34:10] openhabian@openHAB:~$ dpkg --list | grep openhab
ii openhab2 2.4.0-1 all openhab2

http:///amazonechocontrol/ reports:

Amazon Echo Control RC 1

Everything shows online in paper UI.

Logging out and back in does not fix anything.

At this point it seems like nothing Alexa related is working for me.

Oops, sorry :man_facepalming:. Found this thread via google and didn’t read the title, only the answers. But thank you.

I successfully added the 2.5RC1 version of the binding and I can see the RC 1 in the title of the amazonechocontrol page. I also tried “logout and create new device id”. But I still get the “Unauthorized” message.

Maybe worth mentioning: I’m running openhab 2.4.0 as Docker container on an Odroid N2 which has arm64v8 architecture.

Ok so the same versions as me - but everything on mine works.

Sounds like this needs referring to michi, would need debugging at the code level I suspect, as it’s not entirely obvious where the issue is (well, it’s obvious that’s in some form of authorization issue based on the output in the logs, but whether that’s an issue with the binding - which seems unlikely since some work some don’t, issue with your configs - also unlikely based on how many people are getting this issue, something incorrectly stored or not getting updated in OH cache - possible (i assume you’ve all tried clearing cache as per previous suggestions), a problem with the Amazon API service - again less likely since it works for some and not others, or perhaps some security change within Amazon for new echo accounts,… who knows)

I assume if you logon to https://alexa.amazon.com with your usual credentials it also works ok? No updated terms and conditions to accept before continuing or anything stupid like that?

Clearing cache and tmp does not help in my case. Credentials are working nothing to accept. Old installation on raspberry pi worked. New installation with exact the same configuration and bindings on an Mac mini is not working.

Still getting:
An error occurred while calling method ‘ThingHandler.handleCommand()’ on ‘org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@3c0547’: POST url ‘https://alexa.amazon.de/api/behaviors/operation/validate’ failed: Unauthorized

org.openhab.binding.amazonechocontrol.internal.HttpException: POST url ‘https://alexa.amazon.de/api/behaviors/operation/validate’ failed: Unauthorized

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

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

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

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

at sun.reflect.GeneratedMethodAccessor110.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.$Proxy150.handleCommand(Unknown Source) [192:org.openhab.binding.amazonechocontrol:2.5.0.RC_1]

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

Well I just reproduced the error exactly. I went to https://myopenhabip:8080/amazonechocontrol then tried changing the domain to “amazon.de” and submitted. I then tried performing some Alexa calls in OpenHAB GUI (like a flash briefing) and immediately got the same “Unauthorized” error in the openhab.log file. I then changed it back to “amazon.com” and tried again, worked perfectly.

So something specific to German Alexa API by the sounds of things.

EDIT:

I see you mentioned you tried changing the domain as well and it still didn’t work. Did it fully submit properly? Did the error mention ‘alexa.amazon.com’ in the logs once you tested again?

I wonder if Amazon is smart enough with their API servers that they’ll redirect you to the closest one regardless of what it resolves too. You could try creating a static entry for alexa.amazon.de to point to the IP address of alexa.amazon.com as below and see if it makes a difference also?

pi@openhab2:~ $ ping alexa.amazon.com
PING pitangui.amazon.com (52.94.233.137) 56(84) bytes of data.
64 bytes from 52.94.233.137 (52.94.233.137): icmp_seq=1 ttl=237 time=217 ms
64 bytes from 52.94.233.137 (52.94.233.137): icmp_seq=2 ttl=237 time=221 ms
64 bytes from 52.94.233.137 (52.94.233.137): icmp_seq=3 ttl=237 time=224 ms

[ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.handleCommand()’ on ‘org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@1b576f92’: POST url ‘https://alexa.amazon.com/api/behaviors/operation/validate’ failed: Unauthorized

ping alexa.amazon.com

PING pitangui.amazon.com (52.94.233.137): 56 data bytes

64 bytes from 52.94.233.137: icmp_seq=0 ttl=230 time=93.266 ms

64 bytes from 52.94.233.137: icmp_seq=1 ttl=230 time=93.342 ms

64 bytes from 52.94.233.137: icmp_seq=2 ttl=230 time=93.246 ms

64 bytes from 52.94.233.137: icmp_seq=3 ttl=230 time=93.285 ms

64 bytes from 52.94.233.137: icmp_seq=4 ttl=230 time=93.300 ms

still the same errors
(sorry needed to post it in multiple posts because of the 2 links limit for a new user)

While logging in again to amazon I found following log. May this be the issue?
All devices are online after login…

[WARN ] [org.eclipse.jetty.server.HttpChannel] - /amazonechocontrol/account1/ap/signin/132-0918909-1264734

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:885) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.registerConnectionAsApp(Connection.java:725) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.handleProxyRequest(AccountServlet.java:640) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doVerb(AccountServlet.java:230) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doPost(AccountServlet.java:138) ~[?:?]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) ~[29:javax.servlet-api:3.1.0]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[29:javax.servlet-api:3.1.0]
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) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) ~[?:?]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
at

still the same errors
(sorry needed to post it in multiple posts because of the 2 links limit for a new user)

While logging in again to amazon I found following log. May this be the issue?
All devices are online after login…

[WARN ] [org.eclipse.jetty.server.HttpChannel] - /amazonechocontrol/account1/ap/signin/132-0918909-1264734

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:885) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.registerConnectionAsApp(Connection.java:725) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.handleProxyRequest(AccountServlet.java:640) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doVerb(AccountServlet.java:230) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doPost(AccountServlet.java:138) ~[?:?]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) ~[29:javax.servlet-api:3.1.0]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[29:javax.servlet-api:3.1.0]
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) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) ~[?:?]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) ~[84:org.eclipse.jetty.server:9.4.11.v20180605]
at

###########################
tried amazon[com] again - now I cannot get my devices online. Only Alexa enabled Sonos are online. Logout, creating new device ID etc. that all did not work. If I logout and login again I’m automatically amazon[de] again, even if I changed to amazon[com] before logout. On amazon[de] all devices are online but with the Unauthorized error. If I change to amazon[com] now nearly all devices are offline. Restart does not help.
Very strange…

I’m on .com.au so not only German… when I change to .com the auth error resolves, but it can’t find my routines.

To guess in the dark: Can be that the api permissions has changed or some endpoint are deprecated and that the error only hits with newer auth tokens. I am using Docker & do not store the amazon session file. Therefore, I need to authenticate from scratch after each restart. I my case, the problems arose after a maintenance restart.