Release Candidate and Support: Amazon Echo Control Binding

I guess I was able to get this working after a reboot. It works now :stuck_out_tongue:

1 Like

Does this support echo auto? If so, what thing type id should be used?

I have all my echos (12) TTS in a group called gEchoTTS. When I want to send a TTS message to that group, I get:

2019-11-20 08:55:48.651 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@ce4cab': POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Too Many Requests

org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Too Many Requests

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

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

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

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

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

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

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

	at sun.reflect.GeneratedMethodAccessor94.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.$Proxy151.handleCommand(Unknown Source) [191:org.openhab.binding.amazonechocontrol:2.5.0.-2019-09-12]

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

Is it possible to play a custom video/animation on the Echo Show screen via this binding?

If above is not possible. Is it possible to let the echo show show a countdown from 10 seconds?

No, and it can not supported. Only devices which you find in the routines configuration in the alexa app as as a selection option can be used.
Alexa Auto seem to be a “add-on” and not a real device.

This is a known issue. The amazon echo have a request limit. Do not use all devices for TTS at the same time.

No

Is a timer shown on echo show as countdown? If so, there would be a complicated possibility with an http call from a routine…

Well kind of once the timer hits its last 10 seconds. There is a little animation/effect where the numbers count down to zero.
I can send you a video of it via private message of how it looks like if you wish.

Could you add the possibility to delete timers via the Binding.

You can delete timers via Webinterface by hand.

Hi salexes,
the same behavior should then be possible by making REST calls to the amazonechocontrol proxy server. If you have some programming experience, you can make a PUT request again the endpoint /api/notifications/createReminder
The Json format can be derived from this class

To stop a timer make a DELETE request /api/notifications/<Id of the timer>
Sorry, all of them are only hints for you, I don’t have the time to provide a full working example.

Best,
Michael

1 Like

Thank you for the answer I will try to get it working.

I do have one more question, how do I know the ID of the timer ? Do i neet to get it via a REST call aswell?

Hi Michael

watch this thread since months and definetely love your work, appreciate it very much while have been able to set up and successfully run echo, echo plus and echo show.
Just wonder if you are interested to control

echo connect

as well?
If yes, let me know, I may be able to serve with any log / help you may need. (maybe open a seperate thread for this or even PM me)

Keep on your fantastic work, thousands of OH user love that

BR
Marcus

I need your help. I have the same problem as desrcibed in several post here, but could’t find a hint to solve my problem.

Found something (here), that if a lot of requests are made in a short period of time, the server answers with a bad request error. But I don’t think that this is the same issue, because I have the same problem if I just do one TTS Call in 24 hours.

Maybe you have an idea?

Here is the Log:

2019-12-10 23:21:25.547 [hingStatusInfoChangedEvent] - 'amazonechocontrol:echo:account1:echoLiving' changed from UNKNOWN to ONLINE
2019-12-10 23:21:25.555 [hingStatusInfoChangedEvent] - 'amazonechocontrol:echo:account1:echoCorridor' changed from UNKNOWN to ONLINE
2019-12-10 23:21:25.560 [hingStatusInfoChangedEvent] - 'amazonechocontrol:echo:account1:echoKitchen' changed from UNKNOWN to ONLINE
2019-12-10 23:21:25.567 [hingStatusInfoChangedEvent] - 'amazonechocontrol:echo:account1:echoBedroom' changed from UNKNOWN to ONLINE
2019-12-10 23:21:25.698 [hingStatusInfoChangedEvent] - 'amazonechocontrol:account:account1' changed from OFFLINE (CONFIGURATION_PENDING): Wait for login to ONLINE
2019-12-10 23:21:30.152 [vent.ItemStateChangedEvent] - Echo_Living_Room_TTS changed from Test to 
==> /var/log/openhab2/openhab.log <==
2019-12-10 23:21:49.479 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'Test.rules'
==> /var/log/openhab2/events.log <==
2019-12-10 23:21:56.938 [vent.ItemStateChangedEvent] - Basement_Pantry_GasDetector changed from 256.00 to 257.00
==> /var/log/openhab2/openhab.log <==
2019-12-10 23:22:00.414 [INFO ] [ipse.smarthome.model.script.TestRule] - Test
==> /var/log/openhab2/events.log <==
2019-12-10 23:22:00.425 [ome.event.ItemCommandEvent] - Item 'Echo_Living_Room_TTS_Volume' received command 50
2019-12-10 23:22:00.431 [ome.event.ItemCommandEvent] - Item 'Echo_Living_Room_TTS' received command Test
2019-12-10 23:22:00.450 [nt.ItemStatePredictedEvent] - Echo_Living_Room_TTS_Volume predicted to become 50
2019-12-10 23:22:00.461 [nt.ItemStatePredictedEvent] - Echo_Living_Room_TTS predicted to become Test
2019-12-10 23:22:00.464 [vent.ItemStateChangedEvent] - Echo_Living_Room_TTS changed from  to Test
==> /var/log/openhab2/openhab.log <==
2019-12-10 23:22:00.687 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@10b5cdb': 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:549) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNode(Connection.java:1067) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNodes(Connection.java:1076) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.textToSpeech(Connection.java:1038) ~[?:?]
...
...

Items:

// Living
Group Alexa_Living_Room <player>
...
// Commands
String Echo_Living_Room_TTS                   "Text to Speech"                        (Alexa_Living_Room) {channel="amazonechocontrol:echo:account1:echoLiving:textToSpeech"}
Dimmer Echo_Living_Room_TTS_Volume            "Text to Speech Volume"                 (Alexa_Living_Room) {channel="amazonechocontrol:echo:account1:echoLiving:textToSpeechVolume"}
...

Rules:

...
Echo_Living_Room_TTS_Volume.sendCommand(50)  
Echo_Living_Room_TTS.sendCommand('Test') 

Things:


Bridge amazonechocontrol:account:account1 "Amazon Account" @ "Accounts" [amazonSite="amazon.de", email="EMAIL@googlemail.com", password="TOPSECRET", pollingIntervalInSeconds=60]
{
    Thing	echo					echoCorridor		"Alexa" @ "Corridor"     [serialNumber="G090P30904770WFD"]
    Thing	echo					echoBedroom			"Alexa" @ "Bedroom"     [serialNumber="G090LF13801715XK"]
    Thing	echo					echoLiving			"Alexa" @ "Living Room" [serialNumber="G2A0P458814107DF"]
    Thing	echo					echoKitchen			"Alexa" @ "Kitchen"     [serialNumber="G090U78991562HHP"]

    Thing   wha                     echoGroupAll          "Ground Floor Music Group" @ "Music Groups" [serialNumber="b17c667942518ce0bec45ec26141c89f"]
    Thing   wha                     echoGroupGround          "Ground Floor Music Group" @ "Music Groups" [serialNumber="d6c80ba6e96c42f3b231fba6bd5f36fe"]

    
    Thing flashbriefingprofile flashbriefing1 "Flash Briefing Technical" @ "Flash Briefings" 
    Thing flashbriefingprofile flashbriefing2 "Flash Briefing Life Style" @ "Flash Briefings"    
}

Thanks!

Edit:

  • Logout and Login does not solve the problem
  • Restart the system does not solve the problem
  • reinstall the Addon “Amazon Echo Control Binding” does not fix it
  • I am still using the stable version 2.4 - maybe I have to change that?
  • I have no sleep cmd between TTS_Volume and TTS, but this was not a problem in the past.
  • All the Echos are connected with the same amazon account

Did you also clean the cache?

sudo systemctl stop openhab2

sudo openhab-cli clean-cache

sudo systemctl start openhab2 or sudo reboot

1 Like

Thanks for your help @H102.

I solved that problem now by switching to openhab snapshot 2.5.
TTS is working fine with it.

But now my HUE Emulation is not working with alexa anymore, but I’m confident to fix it tonight :wink:

1 Like

Is there any way you can tell when a Flash Briefing is playing (or more the case when it has finished playing)?

I have one set up in the morning and I would like to activate a bluetooth connection to a receiver, play it on speakers, then when done disconnect.

I do the same thing with Spotify, but this I can tell is playing or not using the spotify binding

Now I have another problem with TTS. Maybe you can help me.
TTS is working fine as long as I don’t use SSML.

Works fine:

Echo_Living_Room_TTS.sendCommand('Hello')

Throws an exception:

Echo_Living_Room_TTS.sendCommand('<speak>Hello</speak>')
2019-12-13 11:44:09.042 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.de/api/behaviors/preview' failed: Too Many Requests
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:648) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.lambda$0(Connection.java:625) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_152]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_152]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_152]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_152]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_152]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]

Is Echo_Living_Room_TTS in a group or is it a single item?

If in a group then try removing it from the group and see what happens. Other wise you might try restarting OH since you made a change to the files.

1 Like

There is an active switch channel for flash briefing can any one tell me what this is for? Mine seens to just be on

How can i send a command through a rule

kitchen_TTS.sendCommand('Hohoho, Merry Christmas')  - this works
kitchen_cmd.sendCommand('ask My Media to play Merry Christmas Baby ') - this does not

items:

String kitchen_TTS { channel="amazonechocontrol:echo:6b1d015a:G090LF1175130D7B:textToSpeech" }
String kitchen_cmd { channel="amazonechocontrol:echo:6b1d015a:G090LF1175130D7B:startCommand" }

When asked directly to alexa she will play the song

1 Like