Release Candidate and Support: Amazon Echo Control Binding

Will this also be in the snapshots? And thank you!

From experience with zwave, this is not correct. To update the Thing definitions for unmanaged Things, temporarily remove the file and then put it back.

No

For me, it works without deleting of the thing file. Anyone else can confirm this?

My Things are all managed, but my understanding was based on this discussion, so I thought even the unmanaged Things needed to be deleted to get an updated definition.

With this version, I still get the 500 error when going to the URL and ā€˜No session id receivedā€™ in the log, along with some stack traces (truncated to the first line here)ā€¦

2018-08-10 11:44:37.356 [ERROR] [org.glassfish.jersey.server.ServerRuntime$Responder] - An I/O error has occurred while writing a response message entity to the container output stream.
2018-08-10 11:44:37.334 [WARN ] [org.openhab.binding.amazonechocontrol.internal.Connection] - Illegal json:

The second one contains this (some blank lines removed)

<div id="auth-alert-window" class="a-box a-alert a-alert-error" aria-live="assertive" role="alert"><div class="a-box-inner a-alert-container"><h4 class="a-alert-heading">There was a problem</h4><div class="a-alert-content">
  <ul class="a-unordered-list a-vertical auth-error-messages" role="alert">
    <li id="auth-email-missing-alert"><span class="a-list-item">
      Please provide your email-address or mobile phone number
    </span></li>

    <li id="auth-email-invalid-email-alert"><span class="a-list-item">
      Invalid email address or mobile phone number
    </span></li>

    <li id="auth-password-missing-alert"><span class="a-list-item">
      Please enter your password
    </span></li>

    <li id="auth-guess-missing-alert"><span class="a-list-item">
      Enter the characters as they are given in the challenge.
    </span></li>
  </ul>
</div></div></div>
<!-- show a warning modal dialog when the third party account is connected with Amazon -->
<form name="signIn" method="post" novalidate action="https://www.amazon.com/ap/signin" class="auth-validate-form auth-clearable-form">
      <input type="hidden" name="appActionToken" value="549wWQjgJmTcFXoj2BaTMW9t8kIk4j3D" /><input type="hidden" name="appAction" value="SIGNIN" />

Setting up X redirection on the server, and logging into alexa.amazon.com was successful. The URL also gave the 500 exception.

Which version of java are you running? Iā€™m wondering if the CookieManager may not be working properly in OpenJDK. Iā€™ve tried OpenJDK 1.80_181 and Zulu build 1.8.0_163-b01 with the same results (Login failed: No session id received).

EDIT: Never mind. Iā€™ve tried Oracle, OpenJDK and Zulu. All get the same error.

@michi First of all thank you for bringing this addon into openhab! I have been able to get it to work and can control music on my echo dot. The challenge I am having is with routines. I would like to be able to control specific routines that I have already set up in Alexa via Habpanel. I have not been able to get them to work though. Can you help to provide some example code for different routines so I can see what code I maybe missing? Currently I have the code set up like this.

`

String Echo_Living_Room_StartRoutine ā€œTurn On Movie Modeā€ (Alexa_Living_Room) {channel=ā€œamazonechocontrol:echo:account1:echodot1:startRoutineā€}

`

Still getting the captcha login issue with the new beta, 500 when trying to log in. Back to 2.4 snapshot for now

its a one liner once you have your item setup which you doā€¦
Hereā€™s my morning routine rule (where ā€œStart my Dayā€ is the name of the routine in the Alexa App) with a friendly good morning message before blasting into it:



rule "Morning Andrew"
	when
		Time cron "0 40 07 ? * MON-FRI"
	then
			Alexa_Living_Room_Speak.sendCommand('Good Morning Andrew')
			Thread::sleep(3000)
			Alexa_Living_Room_StartRoutine.sendCommand("Start my day")
end

1 Like

Thank you. I got working in Habpanel! Using the following method

//Turn On Movie Mode
rule ā€œMovie Mode Onā€
when
Item movie_lights changed to ON
then
Echo_Living_Room_StartRoutine.sendCommand(ā€˜Turn On Movie Modeā€™)

end

//Turn Off Movie Mode
rule ā€œMovie Mode Offā€
when
Item movie_lights changed to OFF
then
Echo_Living_Room_StartRoutine.sendCommand(ā€˜Turn Off Movie Modeā€™)

end

I may have missed it, but I havenā€™t seen an explanation for the error ā€˜Login failed: No session id receivedā€™. It looks like Amazon is either being picky about the user-agent string provided or the lack of javascript, but for whatever reason, a Captcha is triggered that the binding canā€™t respond to. There is some interesting discussion in this issue in what I believe is the GH repo of the original script. Iā€™m surprised that this binding is working for anyone, but maybe it is regional (Iā€™m in the US).

Iā€™m not sure why the YOUR_OPENHAB/amazonechocontrol page returns a 500 error, but if there is always a Captcha coming up, then I do not see how this binding would ever work on my system, until some other form of authentication can be implemented. Hope this helps someone before they spend hours trying to troubleshoot why this binding isnā€™t working for them!

Hi Scott,

The reason for this is unknown, but no all users have this problem. I got feedback for a working installation from amazon.com too, so this is not the reason.
It happens, if the login page is requested, but no session-id cookie is set. It would be nice if a experienced user with a litte development skills would work with me to find out the problem.

The captcha is not shown all the time, from the feedback I got, I seems that 10-20% of the get the captcha for the first login. After entering the captcha one time, the following login works without captcha, at least for the most users. It seems that amazon stores some information to detect that the same client makes the request.

Regards,
Michael

Is there a way to stop playing music after a period of time? I have the routine below, but I donā€™t know which command to use to stop the music.

rule "Play a playlist on Pandora"
when
    Time cron "0 58 10 ? * *"
then
    sendCommand(Office_Echo_Provider, 'PANDORA')
    sendCommand(Office_Echo_PlayMusic, 'Sleep Radio')
    pushover("Playing Radio")
    
    radio_timer = createTimer(now.plusMinutes(30)) [|
 		sendCommand(Office_Echo_PlayMusic,STOP)
 	radio_timer = null
 	
 	]
end

Yes, please use the player channel for the stop command

rule "Play a playlist on Pandora"
when
    Time cron "0 58 10 ? * *"
then
    sendCommand(Office_Echo_Provider, 'PANDORA')
    sendCommand(Office_Echo_PlayMusic, 'Sleep Radio')
    pushover("Playing Radio")
    
    radio_timer = createTimer(now.plusMinutes(30)) [|
 		sendCommand(Office_Echo_Player,STOP)
 	radio_timer = null 	
 	]
end

Not tested, but should work.
Regards,
Michael

Items file:

Player Office_Echo_Player       "Player"    {channel="amazonechocontrol:echoshow:<my redacted ID>:player"}

Iā€™ve tried without any success.

sendCommand(Office_Echo_Player,'Stop')
sendCommand(Office_Echo_Player,STOP)
sendCommand(Office_Echo_Player, STOP)

Hi, sorry, there exist no STOP command. The player have a PAUSE command. OFF should work too (But makes no difference to alexa, both sent the same command).

sendCommand(Office_Echo_Player,PAUSE)
1 Like

That worked! Thank you!! I LOVE your binding!!

Iā€™m having trouble with the bata version above. I use 2 factor authentication. After Iā€™ve logged in using the captcha I get the following:

HTTP ERROR 404
Problem accessing /amazonechocontrol/account1/ap/signin. Reason:

    Not Found

Amazon does still send me the code to enter, but I have nowhere to put it.

This is not a problem with the previous release.

Is it possible to increase the alarm sound volume?

amazonechocontrol:echo:account1:echo1:volume is for the normal sound volume, isnā€™t it?

Hi i have a Problem since a few days. TTS isnĀ“t working anymore. Get the Error Message:
17:14:12.546 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method ā€˜ThingHandler.handleCommand()ā€™ on ā€˜org.openhab.binding.amazonechocontrol.handler.EchoHandler@521c6174ā€™: POST url ā€˜https://alexa.amazon.de/api/behaviors/previewā€™ failed: Bad Request
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:404) [245:org.openhab.binding.amazonechocontrol:2.4.0.201808172154]
at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommand(Connection.java:727) [245:org.openhab.binding.amazonechocontrol:2.4.0.201808172154]
at org.openhab.binding.amazonechocontrol.internal.Connection.textToSpeech(Connection.java:685) [245:org.openhab.binding.amazonechocontrol:2.4.0.201808172154]
at org.openhab.binding.amazonechocontrol.handler.EchoHandler.handleCommand(EchoHandler.java:420) [245:org.openhab.binding.amazonechocontrol:2.4.0.201808172154]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.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) [94:org.eclipse.smarthome.core:0.10.0.201808011124]
at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [94:org.eclipse.smarthome.core:0.10.0.201808011124]
at com.sun.proxy.$Proxy216.handleCommand(Unknown Source) [245:org.openhab.binding.amazonechocontrol:2.4.0.201808172154]
at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [101:org.eclipse.smarthome.core.thing:0.10.0.201808011124]
at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [101:org.eclipse.smarthome.core.thing:0.10.0.201808011124]
at sun.reflect.GeneratedMethodAccessor156.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) [94:org.eclipse.smarthome.core:0.10.0.201808011124]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [94:org.eclipse.smarthome.core:0.10.0.201808011124]
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) [?:?]

have somebody any ideas how to fix this?

Hey guys,

for whatever reason the account thing is repeatedly signing out of Amazon. I notice as I all of a sudden repeatedly receive two factor verification SMS and at the same time Alexa related things are no longer reachable via my echo spot (naturally).

Works again after signing in for a day or two, then it signs out again. Any solutions available in the mean time? For me this issue simply kills this binding, sadly. Would it be worth a try to create a dummy Amazon account and use it to log in to the binding, thus cancelling out the possibility of causing it to lose the session when one logs into the same Amazon account from a different device?

Hi, there is no solution. Obviously not everyone has this issue. For me the binding is not really usable because of this issue too. I did ask for help several times in the past, but there is not a real solution. My binding is sometimes going back to online after it stayed offline for days, just because I dont care about the binding any more.

1 Like