Release Candidate and Support: Amazon Echo Control Binding

I actually forgot to remove the bindings before installing beta 9. I noticed I was missing the “Remind” and “PlayAlarmSound” options so I deleted the things and reinstalled them manually. That fixed it.

Thanks @MikeH I will give that a try.

So you see the channels in the PaperUI?

Yes, I see them now.

This seems to be a cool binding!
I would really like to try B9 with my OH2.2 installation but my login fails (with manual things and Paper-UI configuration tried separately). I have not installed a version before.

Log with DEBUG on:

20:07:49.313 [DEBUG] [amazonechocontrol.internal.Connection] - Make request to https://alexa.amazon.de/api/bootstrap?version=0 20:07:49.475 [DEBUG] [amazonechocontrol.internal.Connection] - Redirected to https://www.amazon.de/ap/signin?showRmrMe=1&openid.return_to=https%3A%2F%2Falexa.amazon.de%2Fapi%2Fbootstrap%3Fversion%3D0&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.assoc_handle=amzn_dp_project_dee_de&openid.mode=checkid_setup&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0& 20:07:49.503 [DEBUG] [amazonechocontrol.internal.Connection] - Make request to https://alexa.amazon.de/api/bootstrap?version=0 20:07:49.693 [DEBUG] [amazonechocontrol.internal.Connection] - Call to https://alexa.amazon.de/api/bootstrap?version=0 succeeded 20:07:49.704 [INFO ] [amazonechocontrol.internal.Connection] - Login failed:{} org.openhab.binding.amazonechocontrol.internal.ConnectionException: Login fails. at org.openhab.binding.amazonechocontrol.internal.Connection.makeLogin(Connection.java:420) ~[?:?] at org.openhab.binding.amazonechocontrol.handler.AccountHandler.checkLogin(AccountHandler.java:248) ~[?:?] at org.openhab.binding.amazonechocontrol.handler.AccountHandler.lambda$0(AccountHandler.java:197) ~[?:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:?] at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.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) [?:?]

I did check mail and password thoroughly … any ideas?
Is it ok to receive “login failed” messages with INFO?

OK thx,

I had to remove the binding via the Karaf console. Now it is looking good.

@michi
This is really great stuff!!

Best regards
Timmi

I should change the level, you are right.

You can try to enable debug level. Than you should see a message like ‘Received content after login <???>’. Maybe you find the hint in the response, but you should not post it here, because I’am not sure if there is any private information in it. Have you turned of 2 factor authentication?

michi,
I setup a private song playlist in my amazon prime account. How do I get it to play?

You should see the playlists in the paperUI in the dropdown of the amazonMusicPlayListId channel. If you select one it should start playing. The channel amazonMusicPlayListIdLastUsed provides the id of this list. This id can be used in rules or mapping to write it to the amazonMusicPlayListId channel.

Thanks Michi, I got it working! Nice update. I like all the new features, especially the reminder feature.

Thanks @michi, my login problem got solved by itself: I’ve shutdown my Desktop-Computer at 8pm yesterday while openHAB was still running on the server. The login succeeded at 9:40pm. I did nothing but having myself logged on alexa.amazon.de on my Desktop all the time. Is it possible that being logged on alexa.amazon.de at the same time does interfere with this binding’s login process?

Congrats for this nice binding! Great work!

I tried the Alarm feature. Is there a way to stop the alarm as well through this binding?

Some other minor suggestions for the naming of channels in PaperUI:

  • Bluethooth Verbinding -> Bluetooth Verbindung (actually typo with all “Verbinding”)
  • Erinnere -> Erinnerung (since all other channels are not an imperative clause either)

@michi

This happens if I set the Prime Playlist ID:

2018-01-28 11:32:33.699 [INFO ] [mazonechocontrol.handler.EchoHandler] - handleCommand fails: {}
org.openhab.binding.amazonechocontrol.internal.HttpException: Bad Request
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:337) [238:org.openhab.binding.amazonechocontrol:2.3.0.201801271315]
	at org.openhab.binding.amazonechocontrol.internal.Connection.playAmazonMusicPlayList(Connection.java:567) [238:org.openhab.binding.amazonechocontrol:2.3.0.201801271315]
	at org.openhab.binding.amazonechocontrol.handler.EchoHandler.handleCommand(EchoHandler.java:268) [238:org.openhab.binding.amazonechocontrol:2.3.0.201801271315]
	at sun.reflect.GeneratedMethodAccessor115.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) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at com.sun.proxy.$Proxy138.handleCommand(Unknown Source) [238:org.openhab.binding.amazonechocontrol:2.3.0.201801271315]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:72) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
	at sun.reflect.GeneratedMethodAccessor114.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) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
	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) [?:?]

Also I see there are a lot of item updates received but the radio channel for example.

2018-01-28 11:33:59.637 [vent.ItemStateChangedEvent] - Echo_EW_Radio changed from ON to OFF
2018-01-28 11:33:59.656 [vent.ItemStateChangedEvent] - Echo_EW_Radio changed from OFF to ON
2018-01-28 11:34:04.111 [vent.ItemStateChangedEvent] - Echo_EW_Radio changed from ON to OFF
2018-01-28 11:34:04.119 [vent.ItemStateChangedEvent] - Echo_EW_Radio changed from OFF to ON
2018-01-28 11:34:19.548 [vent.ItemStateChangedEvent] - Echo_E1_Radio changed from ON to OFF
2018-01-28 11:34:19.559 [vent.ItemStateChangedEvent] - Echo_E1_Radio changed from OFF to ON
2018-01-28 11:34:20.971 [vent.ItemStateChangedEvent] - Echo_E1_Radio changed from ON to OFF
2018-01-28 11:34:20.980 [vent.ItemStateChangedEvent] - Echo_E1_Radio changed from OFF to ON

Best regards
Timmi

Sorry I meant the official Alexa app in iOS - dont let me distract you.

While trying…

Echo_Living_Room_Remind.sendCommand("Hello This is a test")

…it fails with message:

2018-01-28 17:07:15.850 [INFO ] [mazonechocontrol.handler.EchoHandler] - handleCommand fails: {}
org.openhab.binding.amazonechocontrol.internal.HttpException: Internal Server Error
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:337) [145:org.openhab.binding.amazonechocontrol:2.3.0.201801271315]
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequestAndReturnString(Connection.java:441) [145:org.openhab.binding.amazonechocontrol:2.3.0.201801271315]
	at org.openhab.binding.amazonechocontrol.internal.Connection.notification(Connection.java:613) [145:org.openhab.binding.amazonechocontrol:2.3.0.201801271315]
	at org.openhab.binding.amazonechocontrol.handler.EchoHandler.handleCommand(EchoHandler.java:316) [145:org.openhab.binding.amazonechocontrol:2.3.0.201801271315]
	at sun.reflect.GeneratedMethodAccessor203.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) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at com.sun.proxy.$Proxy151.handleCommand(Unknown Source) [145:org.openhab.binding.amazonechocontrol:2.3.0.201801271315]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:72) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
	at sun.reflect.GeneratedMethodAccessor202.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) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
	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) [?:?]

How do you set the playlist id? Are you using the paperUI? Because the channel does not support Prime playlists, only the Playlists which you can define by yourself are supported and they are listed in the PaperUI.

That’s really interesting, does this happen only at a specific time or always? Are you using rules that could cause the problem or does it happen in idle state?

Did you check that your Living Room Echo thing has the “Remind” channel.

Hi, sorry I have no answer. The Internal Server Error is the answer from the Amazon server. Which echo device to you have? Is the Account Thing online?
Another idea: Maybe it’s a problem with the system time. I saw the same error, if I tried to set a reminder in the past. My binding set a reminder which is 5 seconds in the future. But maybe this is too less. Try to set system time of the openHAB system a little bit to the future.
Or we have a problem with your amazon region. Which amazon domain did you use?

Hi Falk,
Currently there is no way to stop it, but this seems to possible to implement in a future version, I have tried in from the webpage and it was possible to stop the alarm from there.
About the channel naming: My idea was, that it should be a hint, that this channel is write only. But you are right, it is not consistent, because the amazonMusicPlayListId is write only too. So I will think about this…
The “Verbinding” typo is already fixed in my code - strange, it seems the I make always the same typo, it was no copy paste problem! Thank’s for the hint. I assume, that there a more typo’s in my code, so if you find it, please report them!
Regards,
Michael

All other functions are working well, account thing remains online. The device is a echo dot, the other one is a echo plus.

Because I saw the remind seems to be able to speak I quickly created this little test rule:

rule "Test"
when 	
	Item switch1 received update 
	then 
        Echo_WZ_Remind.sendCommand("Willkommen zuhause, alle Geräte wurden eingeschaltet")
end

Using Amazn DE so no problem here I guess.
Never mind I will try other things :slight_smile:

Hi, maybe your text is to long, or there is a problem with the german characters. Please check it with a shorter text without special characters.
Regards,
Michael