Released: Openhab2 Amazon Echo Control Binding (controlling alexa from openhab2)

development
binding
alexa
Tags: #<Tag:0x00007fd30b27a188> #<Tag:0x00007fd30b27a048> #<Tag:0x00007fd30b279e40>

(Mark) #668

Alexa, beeps out swear words. So you could try starting your the phrase with something that’s sure to be beeped :grin:

edited to add… Despite reading that it does do this when I tested it I found it doesn’t beep but changes the word a bit instead.


(Michael Geramb) #669

Would be possible, but I’am not sure if channels are the best possibility for such information. But currently it is not possible for a binding to provide an action, which would be maybe better. So the only other idea is to provide an REST service which can be called from a rule which returns the whole list.
Regards, Michael


(Michael Geramb) #670

Yes it is planned, because it’s possible to read out the history. The only problem is, that I do not get any information when the history was changed yet. But if the MQTT connection is possible, it could be provided as channel. Otherwise an REST service through the Servlet could provide this information, which can then be called in a rule.
Regards,
Michael


(Michael Geramb) #671

I assume it is MQTT. I used a firefox plugin which shows me the content of the connection and it says that is MQTT. Currently I have 3 problems.

  1. The current implementation of MQTT in the eclipse paho library does not provide a possibility to provide custom headers, but all the authentication at amazon is done with cookies. But I got already support and there was a pull request for this, so the next version will support this.
  2. The next problem is, that I have no experience with MQTT which makes it a little bit complicated for me.
  3. And the last one, I does not have time for this in the moment ;(

Regards,
Michael


(Michael Geramb) #672

I do not know what is going on here. Check if the channels have the correct type. Because it seems the do not store the correct value. Or try to remove one of this two echo things and check what happens.


(Michael Geramb) #673

It seems this is the expected bug with an not update connection somewhere in a thing. If I found time, I will check this. But do not expect this in the next 2 weeks.


(Paul Miller) #674

Here are my things

{
    Thing echo		LR_Echo		"Alexa" @ "Living Room" 	[serialNumber="G090LF0971160DL3"]
    Thing echo		HO_Echo		"Alexa" @ "Office" 			[serialNumber="G090LF0964851QJA"]
    Thing echo		BR1_Echo	"Alexa" @ "Bedroom" 		[serialNumber="G090P308741307M7"]
    Thing echo		BR2_Echo	"Alexa" @ "Hollys Roomn" 	[serialNumber="G090L90971620LK5"]
    Thing echo		BR3_Echo	"Alexa" @ "O Ryans Room" 	[serialNumber="G090L90963910VUM"]

	
    //Thing wha         ALL_Alexa	"Everywhere" @ "Music Groups" [serialNumber="bff62eee1e5f4d838a11447b03cd0131"]

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

I have disabled BR2 device to see what happens.


(SiHui) #675

I was referring to the account login to see the capcha.

Meanwhile I found out a login to alexa.amazon.de shows the captcha and solves the problem … at least for one or two days.


(Matthieu Lauzon) #676

Hi,

is it posible to know wich alexa device i send a command to?
I know this information is in the web ui of amazon.

That way we couls say: Alexa turn on tv… and it would turn on the tv in the same room we are ( with sme coding on our part).

Knowing what amazon devic receive a command would be a live changer !! Esspaccially for the waf


(Falk S.) #677

Hi @summerguy1, the only known way to achieve this is described here.

I suggest to not try it unless you really know what and how you do it (see also my other posts in this thread). Other option is to wait for a real solution since the way described is a workaround only. Never the less, it really provides a “live changer” feeling.


(darkcheater) #678

I would like to give my +1 on this feature request. Providing a name for the timer is also a requirement :slight_smile:
It would allow me to create a timer when the washing mashine starts so I can ask Alexa how long it will need until it’s done.


(E. Gerland) #679

Is there any option to let Alexa play a barking dog (for security support) :slight_smile:


(Ben) #680

Had to use pastebin as verbose log was too long:

https://pastebin.com/TfWLjNGZ

Here you are :slight_smile:


(Thomas) #681

I’ve been experiencing the amazon echo offline problem too. That is to say, openhabian’s log has periodic entries like this:
‘amazonechocontrol:account:accountX’ changed from OFFLINE (CONFIGURATION_ERROR): Login fails. Check your credentials and try to login with your webbrowser to http(s)://youropenhab:yourport/amazonechocontrol/accountX

During the offline warnings I’ve noticed that echo still works, even when paperui->Things reports that amazon account is offline.

The offline message is intermittent and when it does appear it’s sometimes stubborn to suppress. I think that it occurs either after several days running or perhaps after a reboot. Not sure if either is really involved, I’m still observing/monitoring the issue.

Today the problem returned (hadn’t seen it in days). I visited the amazonechocontrol web URL and everything looked good.

Next I edited the .things file and reduced pollingIntervalInSeconds from 60 to 15. Then I went back to the amazonechocontrol web URL and this time it required a full login (with password & CAPTCHA). The logs are back to normal (no offline warnings). It’s been a couple hours and the offline message has not appeared, so I think I’m good for a few days.

No doubt this will be a temporary fix, but better than doing nothing. Also, I don’t believe that the shorter pollingIntervalInSeconds is helping (further investigation is needed). Rather, I think that the “fix” occurred when the .things file was reloaded I was forced to do a new fresh login. Perhaps this little dance satisfies the Amazon server until its “Keep Me Signed In” time expires.

Hopefully someone discovers an easy workaround and/or permanent solution soon. If I learn anything else I will be back with more feedback.

  • Thomas

(Ben) #682

Tried this, but no luck. Still remains in state “No session ID received” and /amazonechocontrol gives a 500 when clicking the account.


(Thomas) #683

@bezibaerchen: I looked at your logs and can see that you make it to the Amazon Login. But it is asking for captcha, which Openhab cannot do. This is shown in the log as follows: Wichtige Mitteilung! Zum besseren Schutz Ihres Kontos geben Sie bitte nochmals Ihr Passwort ein, und geben Sie dann die Zeichen ein, die in der Abbildung unten gezeigt werden.

The captcha must be entered manually from a web browser. If/when Amazon requires it you must visit http://youropenhab:yourport/amazonechocontrol/deaccount and submit the login with captcha.
Be sure to enable the box named Angemeldet bleiben

I suspect you’ve already done this. But try again.

  • Thomas

(Ben) #684

That’s the issue mate. I can’t make it to that page. When accessing it, I get:

HTTP ERROR 500
Problem accessing /amazonechocontrol/deaccount/. Reason:

Server Error

Caused by:
org.openhab.binding.amazonechocontrol.internal.ConnectionException: No session id received
at org.openhab.binding.amazonechocontrol.internal.Connection.getLoginPage(Connection.java:435)
at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doGet(AccountServlet.java:219)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at org.eclipse.jetty.server.Server.handle(Server.java:534)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
at java.lang.Thread.run(Thread.java:748)
Powered by Jetty:// 9.3.21.v20170918


(Thomas) #685

I lost sight of the “No session id received” exception.That kind of problem is beyond my pay grade. This value is provided by the server to post a form.

It’s a wild guess, but perhaps try a different web browser and revisit the amazonechocontrol URL again. Good luck!

  • Thomas

(Mark) #687

Have you tried this:


(Thomas) #688

@bezibaerchen,

I just spent a couple hours trying to make my system experience your HTTP ERROR 500 problem. For example, I edited the amazon account details in the things file and entered wrong passwords, account names, and caused other unworldly mayhem. I even messed with file permissions, file names, and so on.

I successfully crashed my system a few times, even to the point that one time it took two reboots and a manual system restart to get it working again. But I never experienced any issues with visiting /amazonechocontrol/account/.

Looking back at your comments, the only deviation you’ve made with your OpenHab installation is with the Port number (8090 vs 8080). But you’ve even changed it back to default without success.

It’s probably a good time to log back into your Amazon account (https://www.amazon.de) from your PC. Then confirm the devices in Smart Home-Devices. Plus revisit Settings->devices and confirm your echo devices are still listed and shown as “online.”

Hopefully the binding’s author can lend a hand. Your issue looks like a tough one!

  • Thomas

.