Release Candidate and Support: Amazon Echo Control Binding

The Hue Emulation binding will allow you to control your “Turn On Fans” Amazon Routine. The basic idea is to create a .item file that has something like this:

Number House_Fans    "Fans [%d]"   <light>   [ "Switchable" ]

This will publish the House_Fans item as a discoverable Smart Home device in the Alexa app.You can then create a Alexa voice routine in the Alexa App that controls on this item’s value for your OH rules.

  • Thomas

Hey Thomas,

I think I understand what your saying and how it would work; but I’m confused how Alexa will discover this “switchable” device when there is no actually HUE binding address tied to it?

Here’s one of my HUE entries:

// BookShelf
Dimmer	BookShelf_Dimmer		"Dimmer"			<sun>			(PhilipsHUE)	{ channel="hue:0210:001788babc:1:color" }
Color	BookShelf_Color			"Color"				<colorlight>	(PhilipsHUE)	{ channel="hue:0210:001788babc:1:color" }
Dimmer	BookShelf_ColorTemp		"Color Temp"		<temperature>	(PhilipsHUE)	{ channel="hue:0210:001788babc:1:color_temperature" }
String	BookShelf_Alert			"Alert"				<alarm>			(PhilipsHUE)	{ channel="hue:0210:001788babc:1:alert" }
Switch	BookShelf_Effect		"Rainbow"			<sun>			(PhilipsHUE)	{ channel="hue:0210:001788babc:1:effect" }

Here’s some of my virtual fan switches:

Switch	All_Fans_Switch					"On/Off [MAP(On_Off.map):%s]"					[ "Switchable" ]
Switch	Office_Fan_Switch				"On/Off [MAP(On_Off.map):%s]"					[ "Switchable" ]
Switch	Parker_Fan_Switch				"On/Off [MAP(On_Off.map):%s]"					[ "Switchable" ]
Switch	Ryan_Fan_Switch					"On/Off [MAP(On_Off.map):%s]"					[ "Switchable" ]
Switch	Guest_Fan_Switch				"On/Off [MAP(On_Off.map):%s]"					[ "Switchable" ]
Switch	Bedroom_Fan_Switch				"On/Off [MAP(On_Off.map):%s]"					[ "Switchable" ]

Am I suppose to add the HUE channel info to the end of the [ “Switchable” ] or change it to a switch item and remove the [ “Switchable” ] ?

Please provide answer based on my actual code.

Best, Jay

I have found that the bluetooth switch works (I get an annying Alexa "Now disconnected from ") but then a few seconds later it reconnects. I have also tried the selection method of selecting nothing as well but same result. Anyone got this working?

Hey Mr. Wiseman,

you need the openHAB skill for Aleaxa to control the openHAB items. Your virtual switches should have different labels, because that’s how they are discovered by Alexa.

But this is beond the scope of the Binding described here, so you should better ask at the place where the Amazon Alexa skill is disussed.

HTH
Stefan

I think I have figured it out; I was assuming the HUE Binding was the same thing as the HUE Emulation binding (which they are not).

Best, Jay

  1. The HUE emulation binding will read the .item file and see the special item tags (“Lighting”, “Switchable”). The tags are what will tie the item to the Amazon voice control.

  2. As mentioned by Stefan, the Amazon app uses the item’s label to assign the voice command trigger word(s). So each of your item labels must be unique. What I mean is that you can’t name them all “On/Off” as shown in your example.

Yes, you must use the HUE Emulation binding.

  • Thomas

Thank guys for this; this is fixed now.

The issue I’m having is I’m running on a Synology NAS which means port 80 redirects to port 5000 which is the Synology’s web interface to work with it. This is done at the system level . . .

OH is running on port 8080 which is default.

Alexa is NOT discovering the item devices which makes me believe there is a port announcement redirect issue occurring.

In the paper GUI Hue Emulation binding configuration there is an option that says this:

Some Hue applications require a different port (80) then what openHAB runs on by default (8080). This option will only advertise a different port then what we are listening on. Useful if you have an iptables rule redirect traffic from this port to the openHAB port.

Should I add a value to this option? I tried 80, 5000 and 8080 but no luck . . . Do I have to bring OH completely down for this port to take affect or just turning Discovery OFF and back ON to make it broadcast again?

I’m running OH2.3 build #1281

Best, Jay

I suggest asking for help in one of the existing Hue Emulation topics. For example, here’s two examples that discuss port issues (with solutions):

https://github.com/openhab/openhab2-addons/issues/2881

  • Thomas

Hey Everyone,

I have been struggling with HUE Emulation and here’s what fixed it.

It finally worked when I asked Echo (the tower size unit) to discover vs. the Echo Dot. This took me over 3+ hours to figure out what I was doing wrong, hggg . . .

Echo = v2 (found 37 devices)
Echo Dot = v2 (didn’t find anything)

Hope this helps someone else.

Best, Jay

FWIW, I use the Amazon mobile app to discover the devices and it works reliably. For those that want to do this, navigate to:
SETTINGS → DEVICE SETTINGS → [click + symbol] → ADD DEVICES → OTHER
Then click DISCOVER DEVICES

Previously I used the discovery function in Amazon’s PC desktop app (SMARTHOME->DEVICES->DISCOVER), but lately that method has been unreliable. So I recommend the mobile app instead.

I apologize for my off-topic discussion regarding Hue Emulation. It is a fantastic binding that is the perfect complement to michi’s amazing Amazon Echo Control Binding. Used together, OpenHab can do some impressive things with our little echo devices. My OH2’s latest trick is Alexa now tells me when the postal mail has arrived.
https://www.letscontrolit.com/forum/viewtopic.php?f=2&t=5655&sid=94d78b27abb8b5e47afd5ee81ef6313d

A big Thank You @michi: Using his Echo Control binding I’ve added voice speaking functions and system alert tones to many OpenHab actions. This is just the beginning since his addon can do so much more.

  • Thomas

I’ve had issues with this in the past. The root of the problem is more likely the hardware running openhab. The discovery is resource intense. If the system can’t keep up it won’t find anything.

@michi,
I’m in the USA and having the same problem as above Released: Openhab2 Amazon Echo Control Binding (controlling alexa from openhab2)

My TTS has not been working for some time. Up until a couple weeks ago, it was working flawlessly. Initially it may have been the GZIP, but even on the beta (6) I’m not having luck.

2018-11-08 22:09:37.914 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.handler.EchoHandler@xxxxxxx': POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Bad Request
org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Bad Request
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:500) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNode(Connection.java:966) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommand(Connection.java:954) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.textToSpeech(Connection.java:945) ~[?:?]
	at org.openhab.binding.amazonechocontrol.handler.EchoHandler.startTextToSpeech(EchoHandler.java:640) ~[?:?]
	at org.openhab.binding.amazonechocontrol.handler.EchoHandler.handleCommand(EchoHandler.java:527) ~[?:?]
	at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source) ~[?:?]
	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) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
	at com.sun.proxy.$Proxy144.handleCommand(Unknown Source) [191:org.openhab.binding.amazonechocontrol:2.4.0.201811041600]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [108:org.eclipse.smarthome.core.thing:0.10.0.201811071908]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [108:org.eclipse.smarthome.core.thing:0.10.0.201811071908]
	at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source) ~[?:?]
	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) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
	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) [?:?]
2018-11-08 22:09:38.436 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.handler.EchoHandler@xxxxxxx': POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Bad Request
org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Bad Request
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:500) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNode(Connection.java:966) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommand(Connection.java:954) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.textToSpeech(Connection.java:945) ~[?:?]
	at org.openhab.binding.amazonechocontrol.handler.EchoHandler.startTextToSpeech(EchoHandler.java:640) ~[?:?]
	at org.openhab.binding.amazonechocontrol.handler.EchoHandler.handleCommand(EchoHandler.java:527) ~[?:?]
	at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source) ~[?:?]
	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) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
	at com.sun.proxy.$Proxy144.handleCommand(Unknown Source) [191:org.openhab.binding.amazonechocontrol:2.4.0.201811041600]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [108:org.eclipse.smarthome.core.thing:0.10.0.201811071908]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [108:org.eclipse.smarthome.core.thing:0.10.0.201811071908]
	at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source) ~[?:?]
	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) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
	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) [?:?]

From Italy.
I uninstalled the official binding (I was getting the error “[mazonechocontrol.internal.Connection] - Login failed: POST url ‘https://www.amazon.it/ap/signin’ failed: Not Found”), downloaded the file org.openhab.binding.amazonechocontrol_2.4.0.201811041600.jar and copied to the folder /usr/share/openhab2/addons/.
But the Amazon account thing remains offline.
When I try the amazonechocontrol login web page and insert my credentials I always get to an amazon page telling me:
“Looking for Something?
We’re sorry. The Web address you entered is not a functioning page on our site”

What am I missing?

If I remove the beta binding and reinstall the official one I can login on Alexa website correctly (maybe a problem with the cached data of the browser) but the Amazon Account thing remains “Status: OFFLINE - CONFIGURATION_PENDING Wait for login”

Tried again and again.
I also get a page:
“Please Enable Cookies to Continue
To continue shopping at Amazon.com, please enable cookies in your Web browser.
Once you have enabled cookies in your browser, please click on the button below to return to the previous page.”
but as far as I know cookies are enabled and if I press “go back to previous page” I get the previous error page.

If I use the beta (6) version I get an amazon.com login page and finally land on the “Looking for something?” page. If I use the PaperUI 2.3 binding I get the amazon.it login page and successfully login on the alexa.it webpage, but the Amazon Account thing remains offline.

@michi I think I have the same issue as @gsiviero

7

I’m running von OH 2.3.0.
I get the following entry in openhab.log every 4-5 days:

[mazonechocontrol.internal.Connection] - Login failed: Login fails. Check your credentials and try to login
with your webbrowser to http(s)://<youropenhab:yourport>/amazonechocontrol/XXXXXXX

That was ok for me in the past.
I had to restart alexa binding, and had to logon again on the URL above. But from today on this doesn’t work anymore. If I try to logon again I’ll be forwarded to ALEXA Homepage and the log entries still occurs.
My Echo Devices don’t work any longer…

Anybode an idea what I can do?

1 Like

When will this update be reflected in the paperUI version?

Hi,

I have the same issue, as you.
If I use official 2.3.0 version I land on alexa.de Homepage, but thing remains offline.
If I use 2.4 Beta 6, I can login but finally I land on amazon.com homepage (Looking for something…?)
Alexa Thing still offline
Do you found a solution?

Regards

helmar

Hello, sorry but no, my only “solution” is wait for a new beta or official binding to test and see if the issue will be resolved.

1 Like

Crazy, tried it again with 2.4 Beta 6, now I was able to register, Thing is online. Binding is working…

@omatzyo, @michi,
In case my comments may help, let me add that I’m experiencing a variation of this TTS issue. In my installation the error is intermittent, occurring about one out of five tries. And when the error occurs, sometimes the TTS voice is missing and sometimes it works (despite the error).

And to complicate things a bit more, some rules that use TTS never experience the problem. The difference between them is that the rules immune to the issue have simpler Amazon related actions. They only TTS short messages to one echo device at a time and do not change their volume. The rules that are affected save the volume, set new group volumes, TTS to the group, then restore the original volumes.

Here’s an example of a recently logged error:

2018-11-08 22:09:37.914 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.handler.EchoHandler@xxxxxxx': POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Bad Request
org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Bad Request
at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:500) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNode(Connection.java:966) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommand(Connection.java:954) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.textToSpeech(Connection.java:945) ~[?:?]
at org.openhab.binding.amazonechocontrol.handler.EchoHandler.startTextToSpeech(EchoHandler.java:640) ~[?:?]
at org.openhab.binding.amazonechocontrol.handler.EchoHandler.handleCommand(EchoHandler.java:527) ~[?:?]
at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source) ~[?:?]
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) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
at com.sun.proxy.$Proxy144.handleCommand(Unknown Source) [191:org.openhab.binding.amazonechocontrol:2.4.0.201811041600]
at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [108:org.eclipse.smarthome.core.thing:0.10.0.201811071908]
at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [108:org.eclipse.smarthome.core.thing:0.10.0.201811071908]
at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source) ~[?:?]
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) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
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) [?:?]
2018-11-08 22:09:38.436 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.handler.EchoHandler@xxxxxxx': POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Bad Request
org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.com/api/behaviors/preview' failed: Bad Request
at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:500) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNode(Connection.java:966) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommand(Connection.java:954) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.textToSpeech(Connection.java:945) ~[?:?]
at org.openhab.binding.amazonechocontrol.handler.EchoHandler.startTextToSpeech(EchoHandler.java:640) ~[?:?]
at org.openhab.binding.amazonechocontrol.handler.EchoHandler.handleCommand(EchoHandler.java:527) ~[?:?]
at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source) ~[?:?]
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) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
at com.sun.proxy.$Proxy144.handleCommand(Unknown Source) [191:org.openhab.binding.amazonechocontrol:2.4.0.201811041600]
at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [108:org.eclipse.smarthome.core.thing:0.10.0.201811071908]
at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [108:org.eclipse.smarthome.core.thing:0.10.0.201811071908]
at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source) ~[?:?]
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) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [101:org.eclipse.smarthome.core:0.10.0.201811071908]
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) [?:?]

It’s a USA based amazon account so my .things file specifies amazonSite “amazon.com.” The platform is RPI Openhabian. I’m using Echo Control Binding Beta5 on snapshot 2.4.0~20181104134837-1 (Build #1412). I tried Beta6 and ran into GZip problems, so I reverted to Beta5.

Prior to Beta5 I was running the original binding, which did not experience the error. But I upgraded to the latest OH2 snapshot a few days ago and installed the Beta5 binding. Mainly because I wanted to eliminate the need to sign-in to the Amazon Echo Control Account every five days. Plus I was concerned about the GZip issue.

  • Thomas

I’m using the PaperUi binding and experiencing an unusual period of login stability. In the past after logging into various Amazon sites would invariably mean I would then have to then go through the openhab login procedure but recently the Amazon account thing has stayed online despite using other Amazon sites. I hope by posting this I haven’t jinxed it!