Release Candidate and Support: Amazon Echo Control Binding

Beta 2.4 (3) Feedback on a Synology OH2.3 version:

Clean /cache and /tmp directories; here’s what I get below. It also doesn’t work anymore so I had to roll back to org.openhab.binding.amazonechocontrol_2.4.0.201808101552 version which is the last Beta version working on Synology OH 2.3.

at org.eclipse.osgi.container.Module.start(Module.java:444) [?:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) [?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [9:org.apache.felix.fileinstall:3.6.4]
2018-09-09 16:27:24.778 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/volume1/homes/openhab/addons/org.openhab.binding.amazonechocontrol_2.4.0.201808261949.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.amazonechocontrol [193]
  Unresolved requirement: Import-Package: org.eclipse.jdt.annotation; resolution:="optional"
  Unresolved requirement: Import-Package: org.eclipse.jetty.websocket.client

	at org.eclipse.osgi.container.Module.start(Module.java:444) [?:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) [?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [9:org.apache.felix.fileinstall:3.6.4]
2018-09-09 16:27:24.785 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/volume1/homes/openhab/addons/org.openhab.binding.amazonechocontrol_2.4.0.201808261949.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.amazonechocontrol [193]
  Unresolved requirement: Import-Package: org.eclipse.jdt.annotation; resolution:="optional"
  Unresolved requirement: Import-Package: org.eclipse.jetty.websocket.client

Best, Jay

Does the Aexa API support asking alexa for stuff? Will this openHAB binding support this?
What I want to achieve is to ask alexa “Alexa, are all windows closed”. I got 8 contacts in my house for the windows and I’d really like to ask alexa if all windows are closed. Right not it seems this can only be done by faking a thermostat… is this a planned feature? is this even possible? Thanks in advance!

I believe this is, or will be, something possible through the V3 Alexa skill. You could piece something together with this binding though, if you create a switch item that triggers a rule to calculate the answer to your question, and sends the response back to your Alexa devices as TTS… Then create an Alexa routine to tailor the phrasing of the question.

Sure, that would work… but I find it counter-intuitive to tell Alexa to “turn something ON/OFF” to get the answer “The windows are closed”. I’ll wait for v3 :slight_smile:

Until then I might use a motion detection sensor to trigger this. Any ETA for v3?

Look at Routines in the Alexa app. You can create custom phrases for it to respond to.

Yeah, thats possible. But the routines you create don’t really take into account what I need.
I could create a routine which would let alexa say something… but the decision what she should say is in relation to the state of all windows :frowning:

I don’t get what you mean… and I don’t think you are getting me either :slight_smile:

Create a routine in the Alexa app, which responds to “Alexa, are the windows all closed?”. Have that routine turn on a switch that triggers a rule. In the rule, check the state of the windows, and send an appropriate response to an item linked to the textToSpeech channel of this binding, so that Alexa will then speak the response to the question.

1 Like

+1 that’s what I was thinking too. I do something similar to ask Alex to open and close blinds. She doesn’t normally recognise a ‘open blind’ request, so I used an Alexa Routine with that phrase to trigger a dummy item. When the dummy item is ON a Openhab rule then triggers the actual opening, closing of the blind.

1 Like

Ooooohhhhh! Now I get it! Yeah! I’ll try this later today. Thx a lot and sry for being slow (ノД`)

1 Like

For those running OH2.3 on Synology; here’s the fix to these issues . . .

org.eclipse.jdt.annotation = add this JAR to your addon’s directory → Index of /repositories/eclipse-releases/org/eclipse/jdt/org.eclipse.jdt.annotation/2.0.0.v20140415-1436

org.eclipse.jetty.websocket.client = on the karaf console → feature:install openhab-httpclient

Best, Jay

Hi,
I use .thing files to configure and so I am expecting that I can simply drop the beta jar file into the addons directory and it will use that version in preference to the one in OH? Is that correct?

if so I am running latest milestone and still see the following after droping the RC3 jar file into /usr/share/openhab2/addons/

openhab-binding-amazonechocontrol           │ 2.4.0.M3         │ x        │ Started     │ openhab-addons-2.4.0.M3 │ Amazon Echo Control Binding
openhab-binding-amazonechocontrol           │ 2.4.0.M3         │ x        │ Started     │ openhab-addons-2.4.0.M3 │ Amazon Echo Control Binding

Do I need to activate the new new jar somehow?

Thanks

Paul

You can do this, but you will want to rename the jar, so that it stays the same with every update. Then you can just copy it in, overwriting the previous one, and the binding will update. Otherwise, you can end up with it being cached and running two versions of the binding, like you have. For me, the easiest way to resolve is to run this in Karaf

list -s | grep amazon

Then run…

bundle:uninstall XXX

… where XXX is the ID of the older bundle.

On second though, maybe you never uninstalled it in PaperUI before dropping it into addons? Or have it in your addons.cfg?

Hang on… I just reread your post. You have two versions of the binding installed, but neither are the beta. Did you download the jar from the first post?

Thanks for that @5iver
Following your advise I now have one (renamed) jar file loaded and showing as active

openhab> list -s | grep amazon
257 │ Active   │  80 │ 2.4.0.201808261949     │ org.openhab.binding.amazonechocontrol

Thanks

Paul

1 Like

I just got the amazon fire cube, is it possible to send webpages(like the basic ui) and videos to this with the echo binding? Same for the echo show?

Hi All

Apologies for the basic questions.

Will this binding with an Echo allow me to turn on, off any Item thats a switch in my items file and can it be used for things such as the Spotify Web API to play music etc?

Regards
kris

You can do this without the binding, on some items, with the use of tags and either wemo or hue emulation. Example

Switch CouchLight "Couch Light" <light> ["Lighting"]
	{ mqtt=">[pibroker:cmnd/sonoff4/POWER:command:*:default],
	<[pibroker:stat/sonoff4/POWER:state:default]" }

I was using this with sonoff and wemo emulation, prior to using the binding, and it worked well.

I’ve since install the binding, and found that using the Alexa routines, proxy items and rules you can control most anything you like. Caveat, I’m still adding and testing but no issue thus far.

1 Like

@dastrix80 thanks for the like. As I mentioned I’m still testing and playing around but here’s an example of a rule with proxy items for my garage. I’m using an Esp8266 with door switches, motion detection, and light level all being sent to OH via mqtt.

var Timer stopMotionTimer = null
val int timeoutMinutes = 60
rule "Detect Motion when Garage is Open"
when
    Item Esp_Easy_Motion changed from OFF to ON
then
    if(Proxy_Motion.state == ON && stopMotionTimer === null && ESP_Easy_Door.state == OFF){  // Door open = OFF
    Echo_Plus_TTS.sendCommand('Alert, there is movement in the garage!')
        stopMotionTimer = createTimer(now.plusSeconds(10)) [|
            stopMotionTimer = null
        ]
    }
end

rule "Auto ON Garage Motion Detection after One Hour when Garage is Open"
when
    Item Proxy_Motion changed from ON to OFF
then
    if(stopMotionTimer === null){
        Echo_Plus_TTS.sendCommand('The garage motion sensor will be suspended for one hour')
        stopMotionTimer = createTimer(now.plusMinutes(timeoutMinutes)) [|
        Proxy_Motion.sendCommand(ON)
        stopMotionTimer = null
        Echo_Plus_TTS.sendCommand('Garage motion sensor will be switched back on')
        ]
    }
end

rule "Garage Light Detection"
when
    Item Esp_Garage_Lightlevel received update
then
    val Val_Light = Esp_Garage_Lightlevel.state as Number 
    if(Val_Light >= 550){
        Proxy_Lightlevel.postUpdate(ON)
    }
    if(Val_Light <= 500){
        Proxy_Lightlevel.postUpdate(OFF)
    }
end

Ignore the golbal’s that’s an example/test of its own. The items:

Number Esp_Garage_Lightlevel "Garage Light Level [%d]" <light>
	{ mqtt="<[pibroker:/Esp/Garage/LightLevel:state:default"}

Switch ESP_Easy_Door "Garage Door" <contact>
	{ mqtt="<[pibroker:/Esp/Door/State:state:MAP(ONOFF.map)]" }

Switch Esp_Easy_Motion "Garage Motion" <contact>
	{ mqtt="<[pibroker:/Esp/Motion/State:state:MAP(ONOFF.map)]" }

Switch Proxy_Motion "Motion Switch" <light> ["Lighting"]

Switch Proxy_Lightlevel "Garage Light Detection" <light>

Best part is, I can dictate what response Alexa gives. :grinning: Family fun!

Can you explain how that actually operates in a real sense? for your ‘couch light’ do you say ‘Alexa, turn on Couch Light’?

That’s exactly how it works with my setup and kinda funny because I have an item with the name Couch Light.:smile:

1 Like

I am a total Beginner with OpenHab and my KNX Installation. But I managed to create a Dashboard in Basic UI, to integrate Alexa and also the Echo Control Binding.
I integrated a rule which tells me, when a specific window is opened with TTS.
But I would like to have a Information, if there is a window open for longer than 15 minutes while heating is on.
And I really don’t know where to start.
Your help is really appriciated.
Tank you!