Release Candidate and Support: Amazon Echo Control Binding

Tags: #<Tag:0x00007f61845ecbc0> #<Tag:0x00007f61845ecf08> #<Tag:0x00007f61845ed2a0>

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

I think you need to create a routine in the Alexa app to use the send.Command feature.

All my text using SSML has double quotation marks - and it works so I’d try that.

Echo_Living_Room_TTS.sendCommand("<speak>Hello</speak>")

I use single quotation marks when quotation marks are needed within the structure:

Echo_Living_Room_TTS.sendCommand("<speak>Going,going<break time='1s'/>Gone</speak>")
1 Like

Thanks, for your help. Using double quotation marks doesn’t solve it.
Still an error as long as I use the Tag

2019-12-16 10:14:27.752 [ome.event.ItemCommandEvent] - Item 'Echo_Living_Room_TTS' received command <speak>Going,going<break time='1s'/>Gone</speak>

2019-12-16 10:14:27.769 [ome.event.ItemCommandEvent] - Item 'HouseStatus' received command OFF

2019-12-16 10:14:27.774 [nt.ItemStatePredictedEvent] - Echo_Living_Room_TTS predicted to become <speak>Going,going<break time='1s'/>Gone</speak>

2019-12-16 10:14:27.788 [vent.ItemStateChangedEvent] - Echo_Living_Room_TTS changed from to <speak>Going,going<break time='1s'/>Gone</speak>

2019-12-16 10:14:27.792 [vent.ItemStateChangedEvent] - HouseStatus changed from ON to OFF

2019-12-16 10:14:29.411 [vent.ItemStateChangedEvent] - Echo_Living_Room_TTS changed from <speak>Going,going<break time='1s'/>Gone</speak> to

==> /var/log/openhab2/openhab.log <==

2019-12-16 10:14:30.338 [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]

Logging without Tag :

2019-12-16 10:19:15.576 [ome.event.ItemCommandEvent] - Item 'Echo_Living_Room_TTS' received command Going,going<break time='1s'/>Gone</speak>

2019-12-16 10:19:15.595 [ome.event.ItemCommandEvent] - Item 'HouseStatus' received command OFF

2019-12-16 10:19:15.601 [nt.ItemStatePredictedEvent] - Echo_Living_Room_TTS predicted to become Going,going<break time='1s'/>Gone</speak>

2019-12-16 10:19:15.620 [vent.ItemStateChangedEvent] - Echo_Living_Room_TTS changed from to Going,going<break time='1s'/>Gone</speak>

2019-12-16 10:19:15.623 [vent.ItemStateChangedEvent] - HouseStatus changed from ON to OFF

2019-12-16 10:19:17.657 [vent.ItemStateChangedEvent] - Echo_Living_Room_TTS changed from Going,going<break time='1s'/>Gone</speak> to

any other ideas?

Edit: It seems to be exactly the tag . All other tags like are working without an error.

I deleted all groups in the Alexa app and remove the group for the Item Echo_Living_Room_TTS in the items file.

String Echo_Living_Room_TTS                   "Text to Speech"                         {channel="amazonechocontrol:echo:account1:echoLiving:textToSpeech"}
Dimmer Echo_Living_Room_TTS_Volume            "Text to Speech Volume"                  {channel="amazonechocontrol:echo:account1:echoLiving:textToSpeechVolume"}

Now the Item Echo_Living_Room_TTS should have nothing to do with any group :wink:

But this does not solve the problem.
Thanks for your help

Thanks for all your help.
I could solve my problem now by “Logout and create new device id” (by open the url YOUR_OPENHAB/amazonechocontrol in browser)

When I play an alarm sound can I also display a message on echo show and the same time.

Because right now it plays an alarmsound and the display just shows: It is 5:45pm
While I would like to display something like:
Alarm! Garagedoor is open

Hello!

I have a question regarding Amazon Echo Control Binding included in OH #1778 snapshot. Namely, does it support querying state of the device? I’ve upgraded OH to #1778, removed both, Amazon Account and My Echo Thing and recreated them, changed my items, so they use metadata instead of tags (to comply with v3.0 skill), but when I ask for the state of my device (light for example) Echo replies that “this is not supported yet”. Am I doing something wrong, or querying state of the device is not supported with this version of the binding?

Best regards,
Davor

Do you know what the request limit is how how many devices we can call at once? So we can stagger them in groups to not get this error?

I still get an error when it sends this and each group only has 3 members in it.

gDuringHours1_TTS.members.forEach[ i | i.sendCommand(Kettle1TTS)]
Thread::sleep(3000)
gDuringHours2_TTS.members.forEach[ i | i.sendCommand(Kettle1TTS)]
Thread::sleep(3000)
gDuringHours3_TTS.members.forEach[ i | i.sendCommand(Kettle1TTS)]

Not sure if i’m doing something wrong, but three members doesn’t seem like a lot to be getting a failed: Too Many Requests. error

Thats available in the beta (possibly the 2.5GM release as well?)

Show an announcement on the echo show or echo spot:

  1. Create a rule with a trigger of your choice

Simple:

rule "Say welcome if the door opens"
when
    Item Door_Contact changed to OPEN
then
    Echo_Living_Room_Announcement.sendCommand('Door opened')
end

Expert:
You can use a json formatted string to control title, sound and volume:

{ "sound": true, "speak":"<Speak>" "title": "<Title>", "body": "<Body Text>", "volume": 20}

The combination of sound=true and speak in SSML syntax is not allowed.
Not all properties need to be specified.
The value for volume can be between 0 and 100 to set the volume.
A volume value smaller then 0 means that the current alexa volume should be used.
No specification uses the volume from the textToSpeechVolume channel.

You can use a json formatted string to control the title and the sound:

{ "sound": true, "speak":"<Speak>" "title": "<Title>", "body": "<Body Text>"}

The combination of sound=true and speak in SSML syntax is not allowed

Note: If you turn off the sound and alexa is playing music, it will anyway turn down the volume for a moment. This behavior can not be changed.

rule "Say welcome if the door opens"
when
    Item Door_Contact changed to OPEN
then
    Echo_Living_Room_Announcement.sendCommand('{ "sound": false, "title": "Doorstep", "body": "Door opened"}')
end

I have some problems with the volume after echo spoke a text.
The comment is spoken at the right volume, because I set it to 6 in the rule - but afterwards echo is too quiet - I always have to turn the volume up. Any solution for that?
It´s a first generation echo.

Hi Marcus,
I will not support this device because I have no personal interest in this device. But I you are a developer (regardless of the programming language - the binding is my first java program, I’am normally a .NET developer, so this little bit of java should not be the problem), I would support you to add this feature to the binding.
Best,
Michael

Hi, there is only one native volume for the alexa. The TTS volume channel makes an emulation by setting the volume from the TTS colume channel, speak the text and reset the volume to the last known volume.
If you want generally change the volume, use the normal volume channel.

This is not related to the binding. Only the Alexa Skill is involved in this query.

Yes, I’am not sure, but I believe it is a GET to /api/notifications

Hello!

Thank you for your reply. I found out I posted question in the wrong topic, and I was sure I’ve deleted the post. Obviously, I haven’t. Sorry for the confusion.

Best regards,
Davor