Release Candidate and Support: Amazon Echo Control Binding

Tried it, and it gives the same degree of a pause as using a comma
Is there a way to extend the pause for longer?
Thanks
Paul

Ok so I got this working using the code below for any one elese that may find it useful.

It ended up not being what I wanted.
Although this can trac the ONLine / Offline state changes it does not provide a way to discover the current state of an Echo device which is what I am really after.

Is they any tricks for this?

RULE for Thing State

// Somewhere in your .rule file.
rule "Amazon Echo Account Online Status"
when 
	Thing "amazonechocontrol:echo:account1:BR4_Echo" changed
then
	logInfo("EchoStatus.rules","Trigger: "+triggeringItem.name.toString)
    var EchoThing = getThingStatusInfo("amazonechocontrol:account:account1").getStatus()
    logInfo("EchoStatus.rules" , 'Amazon Account Status is ' + EchoThing)
    ConnectionLostTime = now
    
    if(EchoThing.toString() != 'ONLINE') {
        logInfo("EchoStatus.rules" , 'Amazon Echo Account is now ' + EchoThing + '. Starting Offline Timer')
        if (OfflineTimer === null) {
            OfflineTimer = createTimer(now.plusSeconds(30)) [|
                OfflineTimer?.cancel()
                OfflineTimer = null
                var AccountStatus = getThingStatusInfo("amazonechocontrol:account:account1").getStatus()
                if(AccountStatus.toString() == 'OFFLINE') {
                    logInfo("EchoStatus.rules" , 'Amazon Echo Account offline too long. Sending email to ' + emailRecipients)
					//createTimer(now.plusSeconds(3600)) [|
						//if (AccountStatus.toString() == 'OFFLINE') {sendMail(emailRecipients, "Openhab Warning: Amazon Account is Offline!", "Openhab\'s Amazon Account Connection lost on " + ConnectionLostTime.toString('MM/dd/yy HH:mm a') + ".\r\n") }
					//]
				}	
            ]
        }    
    }
    else if(EchoThing.toString() == 'ONLINE') {
        logInfo("EchoStatus.rules" , 'Amazon Echo Account is now ' + EchoThing + ', Canceled Offline Timer')
        OfflineTimer?.cancel()
        OfflineTimer = null
    }
end

It’s all explained in the SSML document to which I linked in my post.

For example, from the doc, a break of three seconds:

<speak>
     Mary had a little lamb <break time="3s"/>Whose fleece was white as snow.
</speak>

Hi Mainteners,

i have still the problem with the TTS Funktion that will log this error:

2019-04-13 12:33:16.925 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.handleCommand()’ on ‘org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@c0cb04a’: 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:593) ~[?:?]

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

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

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

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

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

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

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

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.$Proxy178.handleCommand(Unknown Source) [191:org.openhab.binding.amazonechocontrol:2.5.0.Beta_06]

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.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

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

Information: openhab2.4 stable and newest binding

I have no group only one Echo that will play the massage. Need help to fixed…

Thanks Mario

Still the same problem with snapshot #1569

Maybe this is a more general problem?( have to recreate thing at every startup; readding them from the inbox)

this was not present in #1566

@Kai ?

Looks like a bug to me, see also my comment in Snapshot 2.5.0~S1569-1 broke zwave things.

Thanks @Kai

@Saracen
That is awesome, thanks for pointing out the presence of the link.
I have difficulty seeing the links from normal text.

Regards
Paul

Hey Michael,

Is it possible to create an item for the binding that does the Alexa notifications (yellow blinking light)? This would allow us to trigger delivery notifications (item coming, item delivered, etc.).

Keep up the great work! One of the most important bindings in my collection.

Best, Jay

Hi Guys, does anyone have continued issues with using a group with your TTS channels inside to send alerts? Its very flakey and never works consistently. I dont think this is really a binding issue but perhaps some kind of rate limit on Alexa requests. Is there a way around this or even a method to pay for more requests to the Alexa?

Thanks

Are you sending alot of requests to Amazon? I get this error too.

Have you tried adding org.eclipse.smarthome.threadpool:RuleEngine=20 at the end of /etc/openhab2/services/runtime.cfg to see if that helps? I can not, at the moment, remember exactly what this does but it may be worth a try.

1 Like

Ill give it a go! Thanks

Beta 7 released

This is a bugfix release with no new features.

  • Fix issue ‘Bad request’ for TTS calls if the devices are owned by another customer id than the account
  • Repeat calls in case of ‘Bad request’ if there are many request at the same time

Download Beta 7 from the top most posting

Roadmap

openHAB 2.5:

  • I will create a pull request for this version to get merged into the openHAB master, so that it will hopefully part of the offical OH 2.5

openHAB 2.6:

  • Q3/2019 feature for synchronization of timers and alarms between alexa devices

openHAB 2.7:

  • 2020 support for smarthome devices connected directly to echo devices (e.g. build in smarthome hub)
5 Likes

Hi Jay,
The notifications have an documented API for Alexa Skills. But I assume, that a Skill could only be one of the different type of skills and the current existing openHAB skill is a smarthome skill. So I assume, a new skill would be necessary for this. But I’am not really sure, maybe you can ask the developer of the openHAB skill.
I do not see currently any possibility to this from the binding. But of course, this could change if amazon add this feature to routines.
Best,
Michael

Hi @michi

Group announcements are now working much better. They are more in sync

Echo Dot, Echo Show, Echo all in a group >>> I make short attention tone and then the announcement to the group >>> all 3 are now in sync and there are no errors in the log but …

I did have an initial error while I was updating some other rules I was working on but its not repeated since.

2019-04-18 10:18:56.149 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@11a90a': 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

Thanks, Mark.

Hi @michi,

I just installed the latest beta, but when I try to login, I get the following error:

HTTP ERROR 500

Problem accessing /amazonechocontrol/bfd9850d/ap/signin. Reason:

Server Error

Caused by:

org.openhab.binding.amazonechocontrol.internal.HttpException: POST url ‘https://www.amazon.com/ap/signin’ failed: Found at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:628) at org.openhab.binding.amazonechocontrol.internal.AccountServlet.handleProxyRequest(AccountServlet.java:628) at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doVerb(AccountServlet.java:225) at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doPost(AccountServlet.java:133) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

Do you have any idea what I am doing wrong?

Thanks a lot!
Christoph

1 Like

@michi
Hi Michael - Am continuing to have issues with the binding - Ive followed your instructions that I must use a beta version - I’ve now tried version 6 & 7 and I’m no further forward in being able to use the binding. - prior to the change in the binding I had little issue - when i could add the .com.au suffix (under OH2.3 - In paper ui)

I get the following error
HTTP ERROR 500
Problem accessing /amazonechocontrol/854bfe87/ap/signin/131-8618649-0793801. Reason:

Server Error

Caused by:
org.openhab.binding.amazonechocontrol.internal.HttpException: POST url ‘https://www.amazon.com/ap/signin/131-8618649-0793801’ failed: Found
at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:628)
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.handleProxyRequest(AccountServlet.java:628)
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doVerb(AccountServlet.java:225)
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doPost(AccountServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:531)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680)
at java.lang.Thread.run(Thread.java:748)

I am using OH2.4 Release Build
Thanks
Matt

That does not work for me:
“speak and break” are both just said by alexa.
How did you make it run? @Saracen?

Did you copy and paste the text from the post or re-type it?

Try copy-and-pasting it verbatim in case you are using the wrong characters for the quote marks.

echo_TTS.sendCommand('<speak>Wait for the <break/> Pause</speak>')