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

development
binding
alexa
Tags: #<Tag:0x00007f014c326910> #<Tag:0x00007f014c326780> #<Tag:0x00007f014c326618>

(Timmi) #1194

Hi Tobias,

please try this:
AmazonEchoDotWohnzimmer_Speak.sendCommand(“Alarmanlage nach " + Alarmanlage_Switch.state.toString + " geändert”)

You can also use the translate function here.
like this:
transform(“MAP”, “de.map”, Alarmanlage_Switch.state.toString)

Best regards
Timmi


(Tobus) #1195

Cool that works! Thanks!


(emik) #1196

Hi Michi,

unfortunately I still cannot use this great addon since a couple of days because of this message:


I have tried to replace the URL as stated above but I believe there is an error in the post. I added the hoste name to the URL aswell, but I am always redirected to the “Amazon Account” webpage that links to the login page.
If you have a workround for me I would be very glad!

Many thanks!
E.


(David) #1197

Hello, is it possible to start a skill like camera ?


(Michael Geramb) #1198

No, there exist no API for this from amazon.


(Michael Geramb) #1199

Hi to everybody with login problems in BETA 7,
I have tried to fix the problem with my beta 8 version. But I don’t know if it works for you because I can not reproduce the problem.
If it does not yet work, please save the source of each page in the login process and the url shown in the browser. If the url does not start with the OH installation, please send me the source of the previous page.

If the login works now, please give me feedback too.

Thanks for your support,
Michael


(Michael Geramb) #1200

BETA 8 released:

There is no need to upgrade from BETA 7 if it is working for you.
I change a litte bit the code for the proxy for the login and hope it fixes the last problems. The announcment channel is removed, because it does not work and I have no change to check whats going on because the API does not exist in amazon.de.

Best regards,
Michael


(nively) #1201

Hi @michi,
Thanks for the support, the version 8 works for me


(Michael) #1202

Hi @michi

Is this the correct download link for the latest beta?


It´s linked in the initial post as Beta (8) but the link says Beta (7).

Thanks!


(emik) #1203

Hi Michi,

the beta 8 is also not working for me.

I have shut down openhab then replaced the new version in the addons directory and restarted openhab. Same problem.

It seems to me that after deleting from the Addons-directory the addon does not get properly deinstalled: The addon is still listed in PaperUI as Binding. Is there a proper way of uninstalling the old version before replacing with the new?
I have the feeling that my installation does not really overwrite the new addon release, instead loading an old version.

What is the best way of finding out which version is installed and running and for uninstalling?

Many thanks for the support!!
E.


(Michael) #1204

You should have a look into the Karaf Console.
With bundle:list you´re able to see which addon is installed and used by openHAB.


(Michael Geramb) #1205

Thank you for your hint, the link is beta 8, I forgot to change the link text.


(Michael Geramb) #1206

You should check out this post:


(Tobus) #1207

Hello Michi,
really great work!!!

At my OpenHab i have some Switch elements, i want to operate via Alexa. But I could not find any Items. Do you have a guide how to do this?

When I go to Smart Home and search, this will be empty.

Thanks
Tobias


(Thomas) #1208

Have you tagged your items, eg

["Lighting"]

Here is an example from alexa openhab doc:


```    Switch Kitchen_Light_A  "Kitchen Light"                   ["Lighting"] {channel="..."}
```

(Michael Geramb) #1209

Hi Tobus, this is the wrong thread for this. You should search for OpenHAB Alexa Skill


(Scott Karns) #1210

Or (my preferred approach to Alexa control, which does not expose my devices outside my home LAN), search for “hue emulation”:

https://community.openhab.org/search?q=hue%20emulation%20order%3Alatest


(Gordon Geist) #1211

Mine as well - if I get some time would love to enhance that binding to expand to HSBColor types and similar.


(Udo Weber) #1212

@michi @david @NCO

I’m having also “out of memory exceptions” since using this binding. All starts with some “UnknownHostException” from the binding, followed by a lot off “OutOfMemoryError” Exceptions.
After that I see that openHab is unable to stop httpClient Threads. Maybe this could be the reason, just guessing?

Greets Udo

Request to url 'https://alexa.amazon.de/api/devices-v2/device?cached=false' fails with unkown error
java.net.UnknownHostException: alexa.amazon.de
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) ~[?:?]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
	at java.net.Socket.connect(Socket.java:589) ~[?:?]
	at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673) ~[?:?]
	at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) ~[?:?]
	at sun.net.NetworkClient.doConnect(NetworkClient.java:180) ~[?:?]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) ~[?:?]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) ~[?:?]
	at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) ~[?:?]
	at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) ~[?:?]
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050) ~[?:?]
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) ~[?:?]
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[?:?]
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:469) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequestAndReturnString(Connection.java:388) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequestAndReturnString(Connection.java:383) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.getDeviceListJson(Connection.java:780) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.getDeviceList(Connection.java:770) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.handler.AccountHandler.updateDeviceList(AccountHandler.java:495) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.handler.AccountHandler.refreshData(AccountHandler.java:390) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.handler.AccountHandler.checkData(AccountHandler.java:360) ~[?:?]
	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) [?:?]

[WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception
java.lang.OutOfMemoryError: unable to create new native thread
	at java.lang.Thread.start0(Native Method) ~[?:?]
	at java.lang.Thread.start(Thread.java:717) ~[?:?]
	at org.openhab.binding.miio.internal.transport.MiIoAsyncCommunication.<init>(MiIoAsyncCommunication.java:86) ~[?:?]
	at org.openhab.binding.miio.handler.MiIoAbstractHandler.getConnection(MiIoAbstractHandler.java:282) ~[?:?]
	at org.openhab.binding.miio.handler.MiIoAbstractHandler.hasConnection(MiIoAbstractHandler.java:243) ~[?:?]
	at org.openhab.binding.miio.handler.MiIoBasicHandler.updateData(MiIoBasicHandler.java:180) ~[?:?]
	at org.openhab.binding.miio.handler.MiIoAbstractHandler.lambda$1(MiIoAbstractHandler.java:97) ~[?:?]
	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) [?:?]



2018-11-30 18:51:58.595 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - HttpClient@5352057{STOPPING,8<=2<=200,i=0,q=4} Couldn't stop Thread[HttpClient@5352057-47439,5,main]
2018-11-30 18:51:58.600 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - HttpClient@5352057{STOPPING,8<=2<=200,i=0,q=4} Couldn't stop Thread[HttpClient@5352057-47561,5,main]
2018-11-30 18:51:58.607 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - HttpClient@5352057{STOPPING,8<=2<=200,i=0,q=4} Couldn't stop Thread[HttpClient@5352057-47511,5,main]
2018-11-30 18:51:58.611 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - HttpClient@5352057{STOPPING,8<=2<=200,i=0,q=4} Couldn't stop Thread[HttpClient@5352057-47578,5,main]
2018-11-30 18:51:58.614 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - HttpClient@5352057{STOPPING,8<=2<=200,i=0,q=4} Couldn't stop Thread[HttpClient@5352057-47579,5,main]
2018-11-30 18:51:58.617 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - HttpClient@5352057{STOPPING,8<=2<=200,i=0,q=4} Couldn't stop Thread[HttpClient@5352057-47512,5,main]
2018-11-30 18:51:58.620 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - HttpClient@5352057{STOPPING,8<=2<=200,i=0,q=4} Couldn't stop Thread[HttpClient@5352057-47468,5,main]
2018-11-30 18:51:58.623 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - HttpClient@5352057{STOPPING,8<=2<=200,i=0,q=4} Couldn't stop Thread[HttpClient@5352057-47562,5,main]
2018-11-30 18:51:58.626 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - HttpClient@5352057{STOPPING,8<=2<=200,i=0,q=4} Couldn't stop Thread[HttpClient@5352057-47469,5,main]
2018-11-30 18:51:58.633 [WARN ] [e.jetty.util.thread.QueuedThreadPool] - HttpClient@5352057{STOPPING,8<=2<=200,i=0,q=4} Couldn't stop Thread[HttpClient@5352057-47560,5,main]

(david) #1213

I tracked down my httpClient thread issue to having both wired and wireless network interfaces active on my Pi. I turned off wireless and the memory issues went away. I would guess the httpclient threads do have issues cleaning themselves up when there are network, or in your case DNS, issues. If I was you, I would track down why you are sometimes unable to resolve alexa.amazon.de. solve that and you may solve your memory issues.