Release Candidate and Support: Amazon Echo Control Binding

Hi michi,
I have install the 2.5 beta (3) and SSML doen not work with amazon.it.
as soon as the TTL sentence starts with , Alexa does not say anything at all.

Regards
Lorenzo

I expect, that the routine which can be used for SSML is not yet deployed at amazon.it. First it was in US, in DE it was available 3 weeks later.
You can check this in your alexa app. If you find the option in the second image, it should work, otherwise you have to wait:

Best,
Michael

Hi, I cannot reproduce your problem. In my installation only the Echo which answers, updates the lastVoiceCommand channel. Are you sure that you see it in both, maybe you speak the same command to both and you see in the channel of one the not update old text?

This is an awesome binding .Thank you !!!..all this while i was looking for a way to get the timers from Alexa so that I can display it on a NeoPixel clock (trying to imitate the Alexa Wall Clock) but was running into dead ends till i stumbled upon this. However, there seems to be an issueā€¦when I set a timer on Alexa, the State of the channel changes to the Timer Expiry for a moment and then changes back to UNDEF as can be seen in the log.

Any idea why ?

2019-01-31 23:36:57.587 [vent.ItemStateChangedEvent] - Echo_Living_Room_Timer changed from UNDEF to 2019-01-31T23:41:56.005+0800
2019-01-31 23:36:57.599 [vent.ItemStateChangedEvent] - Echo_Living_Room_Timer changed from 2019-01-31T23:41:56.005+0800 to UNDEF
201

So the alexa addon is fantastic, but the Image URL has me stumped.

sometimes it will give a good image likeā€¦

https://m.media-amazon.com/images/I/81VJ0gg0qVL._UL600_.jpg

But other times it will give a huge string that is not an image (I xā€™d out some of it as it may have sensitive information in it) this does not end in a .jpg

https://album-art-storage-us.s3.amazonaws.com/8a22ed50f592ebba4b11b47d62dc8994b2536101d6873bd70159ac4b0405bb8a_500x500.jpg?response-content-type=image%2Fjpeg&x-amz-security-token=FQoGZXIvYXdzEBYaDOZ%xxxxxdMvtGQJSKsAanNjC1GsnsoYUTLomlwiIMMd94aetEjX7crBC8XyDC67wN2Y9xxxxwrvWVHCn84JT2Kb7hJiR%2FzF%2Fu1RbEo6wuOdAsLxxxxxxxxLxrKtAWWZmHIy1rXk2kOgFcNtrXgDSwg0t%2FaTUpx%2FUFVEiG7DDyABM9Yxxxx2FwKVZVI5eaZavhSxxxxxxxxxxxxxxx3D&AWSAccessKeyId=xxxxxxJVA7U4I&Expires=1548886774&Signature=xxxxxxHfc7SCnBTAg%3D

Any idea why this is, how do I get a good jpg image every time?

I just got an Amazon plug, is there anyway i can integrate it to openhab with this binding ?

Because I can only trigger the on/off via voice command or inside the Alexa app.

Is it possible to somehow check its status and trigger on/off with openhab ?

Trigger can be done with a work around. Create routines for switiching on and off in the alexa app. These routines can be triggered with the binding, but there is no ststus update.
Best, Michael

No, but it wozld be interesting if you see the image in the alexa web site and whats the url there.

Please check the sytem clock on the device running OH

The system clock was showing the correct time. Itā€™s a raspi 3 and I sync it to the NTP servers once in a while

Good point, it actually does not have a picture for the album art. So that must be the reason. Thanks for all the work, this is an awesome add-on!!!

Itā€™s ok ā€¦for some reason itā€™s working properly now.

Hi Michael,

This issue has been happening since I implemented the beta bindings when routine was introduced; Iā€™m not sure why though?

Whenever I start OH up OR push a new rule set; I set a bunch of states on items and one of them is the fans in the house. If Jun - Nov, turn them ON else turn them OFF through an Alexa Routine.

This routine works fine in a rule but in a startup mode; it ā€œmostlyā€ fails with the error below. It does sometimes work but more often not. The routine does exist within Alexa and does work in rules based on virtual switches. Itā€™s just in the startup OR new rule pushing mode this happens.

The Amazon account is ONLINE also.

2019-01-31 06:19:40.018 [WARN ] [mazonechocontrol.internal.Connection] - Routine turn routine fans off not found
2019-01-31 07:46:35.872 [WARN ] [mazonechocontrol.internal.Connection] - Routine turn routine fans off not found
2019-01-31 08:00:35.952 [WARN ] [mazonechocontrol.internal.Connection] - Routine turn routine fans off not found
2019-01-31 09:46:28.914 [WARN ] [mazonechocontrol.internal.Connection] - Routine turn routine fans off not found
2019-01-31 10:21:29.208 [WARN ] [mazonechocontrol.internal.Connection] - Routine turn routine fans off not found

Item Event:

2019-01-31 06:07:04.342 [ome.event.ItemCommandEvent] - Item 'Echo_Living_Room_StartRoutine' received command turn routine fans off

OH Log:

2019-02-01 09:48:32.403 [INFO ] [marthome.model.script.Startup Script] - Echo: Sets All Fans to OFF since the month is NOT between June - Sept
2019-02-01 09:49:04.415 [INFO ] [marthome.model.script.Startup Script] - -----------------------------------------------------------------------------
2019-02-01 09:49:04.416 [INFO ] [marthome.model.script.Startup Script] - Startup Script Done with - Turn Fans On/Off Based Off Month
2019-02-01 09:49:04.417 [INFO ] [marthome.model.script.Startup Script] - -------------------------------------
2019-02-01 09:49:04.434 [INFO ] [marthome.model.script.Startup Script] - Michaels Amazon Account Status is ONLINE
2019-02-01 09:49:04.435 [INFO ] [marthome.model.script.Startup Script] - Tricias Amazon Account Status is ONLINE

Iā€™d be interested if this is happening to anybody else or is just me?

Its NOT a big deal just trying to improve Michaelā€™s binding.

Iā€™m running OH2.3 with the latest Beta 2.5 (3) binding.

Best, Jay

No idea, it seems that the query for existing routines does not return the routine. But I have no idea why this could happen. Maybe it is an issue on amazon site, that the call only works after some time the login, but this seem very uncommon, too.

INFORMATION UPDATE

I just want to give some information to the community.

Can TTS used synchronized on multiple devices?
No.
If the API is called too often at nearly the same time, the amazon server returns an error. This is the reason why you need an delay in OH rules when you sent TTS to multiple devices.
The API used for TTS with SSML allows to define multiple output devices, but unfortunately even there is an offset between the devices. So it makes no sense to include this in the binding code.

Audio tags in SSML are not working
It seems that audio tags are not supported in the used API. Regardless if you use the soundbank url or an normal https urls to MP3.

More tags for SSML
You can take a look at this page. There are tags to select a different voice or speechcons for special sayings.
Nice sample for german users, this let speak alexa with french accent:

<speak><voice name='Celine'>Ich liebe Dich</voice>.</speak>

Support for controlling smarthome devices through this binding
It would be possible to implement this, but I do not own devices which are connect to alexa. So from my side there is no interest to implement this in my free time. But if there is an other developer who want do this, I would support this development.
With the current version of the binding, switching devices can be done with the workaround by using routines in the alexa app and trigger them by the startRoutine channel.

Best,
Michael

I thought the same thing also, so I moved this logic to the bottom of the startup rule but no luck. I also tried setting the volume levels (not really needed for routines, but a call to the Amazon binding on startup as a thought) but that didnā€™t work either. Very strange . . .

		// Turn Fans On/Off Based Off Month

		if (currMonth !== null)		{currMonth = now.getMonthOfYear}
		if (currMonth >= 6 && currMonth <= 9) {

    		logInfo("Startup Script", "Echo: Sets All Fans to ON since the month is between June - Sept")

			if (Alexa_Status.state == 'ONLINE') {

				// Setting volumes specially here to wake up the Echo connection
				Echo_Living_Room_textToSpeechVolume.sendCommand('40')
					Thread::sleep(2000)  // 2 second wait

    			Echo_Living_Room_StartRoutine.sendCommand('turn routine fans on')
					Thread::sleep(10000)  // 10 second wait
 		} else {

    		logInfo("Startup Script", "Echo: Sets All Fans to OFF since the month is NOT between June - Sept")

			if (Alexa_Status.state == 'ONLINE') {

				// Setting volumes specially here to wake up the Echo connection
				Echo_Living_Room_textToSpeechVolume.sendCommand('40')
					Thread::sleep(2000)  // 2 second wait

    			Echo_Living_Room_StartRoutine.sendCommand('turn routine fans off')
					Thread::sleep(10000)  // 10 second wait
			}

			logInfo("Startup Script", "-----------------------------------------------------------------------------")
		}

		logInfo("Startup Script", "Startup Script Done with - Turn Fans On/Off Based Off Month")
		logInfo("Startup Script", "-----------------------------------------------------------------------------")

Best, Jay

Iā€™ve been getting the following error message in my logs since updating the Amazon Echo Control binding to the latest version. Is there something I donā€™t have setup right?

2019-02-02 10:37:19.329 [ERROR] [trol.internal.handler.AccountHandler] - refresh data fails with unexpected error {}
java.lang.NullPointerException: null
    at java.time.chrono.ChronoZonedDateTime.isBefore(ChronoZonedDateTime.java:601) ~[?:?]
    at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.updateNotifications(EchoHandler.java:1294) ~[?:?]
    at org.openhab.binding.amazonechocontrol.internal.handler.AccountHandler.refreshNotifications(AccountHandler.java:407) ~[?:?]
    at org.openhab.binding.amazonechocontrol.internal.handler.AccountHandler.refreshData(AccountHandler.java:508) ~[?:?]
    at org.openhab.binding.amazonechocontrol.internal.handler.AccountHandler.checkData(AccountHandler.java:376) ~[?:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
    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) [?:?]

Thank you Mike for reporting.
This was a bug which happens depending on some data, so I have not seen it in the debugger.

It is fixed now with beta 2.5 (4).

New bugfix Beta 2.5 (4)
This beta fixes a bug from the previous beta 2.5 (3). Download this version from the top most posting.

I realy love this binding!, thanks for all the hard work Michael!

I keep discovering possibillities!, I have nine Echo devices, and since short a Echo Input, connected to my Receiver.
I have it connected as an echo device and it works when i tell it to play music, however i do not see the Image and progress info, (Song, Album, Time played etc)
I get this error in my log (Rpi, OpenHabian, 2.4.0):

2019-02-03 12:07:16.384 [WARN ] [trol.internal.handler.AccountHandler] - handling of websockets fails: {}

org.openhab.binding.amazonechocontrol.internal.HttpException: GET url 'https://alexa.amazon.com/api/equalizer/G090VP048464xxxx/A1JJ0KFC4Zxxxx failed: Internal Server Error at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:586) ~[242:org.openhab.binding.amazonechocontrol:2.5.0.Beta_03]

Is this an config error by me, or is something else wrong?
Thanks
Ray