Binding Request: Amazon Echo

Yes Please:)

Is anyone actively working on a native OpenHAB binding for the Echo? While I’m not a Java guy, I’d definitely like to see the tight integration with it, and am willing to help however possible.

This is really a game changer - adding a new dimension to how we interact with our home automation!

Check out Aaron’s integration with Plex:

For anyone interested in diving deep into this, here are some links of interest from my research thus far:

http://www.charmedquark.com/Web2/Downloads/Documents/4_8/AmazonEcho_4_8.pdf



https://zpriddy.com/

To my surprise adding a skill isn’t very difficult. I was able to quickly define a new ‘skill’ to query wolfram alpha following these examples:


My webserver & wolfram.php receive commands from the Echo, requests results from wolfram API, and returns the ‘words’ for TTS to the Echo. Here is the authors video of this in action:

Using the same approach we should be able to use the echo to directly (via the cloud and a public enpoint) send voice commands to openHAB server, take an action and receive a response. Using some sophisticated OpenHAB voice command rules, this could eliminate the need for the Echo HA Bridge altogether!

Any thoughts/suggestions?

1 Like

A better Java-based example of getting info from the Netamo API:

Wow, wish I would have found this project on gitub sooner!

Nice web sleuthing Mike!

Each reply seems to be getting us closer to the desired result


I assume a skill can just be used to make OpenHAB do stuff. The ideal would be for it to be both ways so also having the Echo speak out alerts using TTS. :slight_smile:

Totally agreed - a proper binding would be ideal! Unfortunately I don’t think that it’s possible today to send ‘push notifications’ to the echo, with the current API. And hacking it by using a Rasberry Pi and bluetooth as a wireless speaker doesn’t seem like a good option.

I am content with at least being able to have customized control over available commands and responses, for now :slightly_smiling:

Best regards,
.

Awesome - I’ve managed to create an OpenHAB ‘shim’ via ASK which can and push arbitrary commands as needed to my OpenHAB instance via a custom VoiceCMD rule. This handles all of my existing OH rules quite well, assuming the VoiceCMD rule logic has already been wired in, without requireing the Echo HA Bridge or the considerable amount of work required with manipulating the ASK models/slots/utterances/etc. (reference https://github.com/Santonian/echo_openhab_skill/)

This approach needs custom development/messaging and is not at all streamlined


Of course its intended merely a PoC and all users would want immediate feedback (i.e. ECHO should say ‘your thermostat has been set to 75 degrees’ after the command has been executed with success)
 Is there a way to manipulate the HTML in an OpenHAB HTTP query or HTTP response code of 200 to return rule-derived text via REST?

Another example, if user says ‘Alexa, ask Jarvis for a status update’ I want it to return the text from the rule execution that I can then parse as ‘raw text’ for the response returned to the Echo. My custom OpenHAB MaryTTS rule response (executed currently via another rule, and on another PC) currently replies with:

“Your home temperature is a comfortable 73 degrees, with a humidity of 20 percent. The Data Center peaked at 56 degrees today. There have been no security violations or vital infrastructure alerts. My battery backup is ONLINE at 100 percent capacity. At current load of 39 percent I can remain online for approximately 120 minutes in the event of a power outage.”

How can I inject this raw text into the response HTML for a query to ‘http://user:password@LOCALIP:8080/CMD?VoiceCommand='status update’?

For the current PoC ASK implementation basically AWS calls:
https://example.com/jarvis.php

And this PHP script calls my internal OpenHAB server with the raw text VoiceCMD to query:

http://user:password@LOCALIP:8080/CMD?VoiceCommand=‘ECHO_CMD’

If response manipulation can be done at this point it would pave the way for a (less than stellar) ASK based ECHO implementation :slightly_smiling: which gets me 80% of the way there, albeit without a native OH binding! Speaking out & push notifications unfortunately are seemingly at the mercy of AWS and the Echo ASK API, without some nasty hacks


.

Success! :slightly_smiling:

Total hack but basically I modified my OpenHAB rules of interest to put the output text to be read by Alexa into a String variable called ‘ECHO_Answer’, and then GET the response text over REST API in my PHP script.

Very happy to have Alexa reading my custom announcements (upon request only), and controlling everything in the house via my pre-existing VoiceCommand rules!!!

.

Great, can you write up a tutorial for us? That would be awesome.

Can you share what you have done?

I will definitely share the code and details once I have wrapped up a few lose ends!

Update - I have been working to rewrite my PHP code in Javascript following the Amazon Alexa JS examples. This gives much better versatility and tighter/cleaner code all around, as well as a great set of logic examples as to how code a complex custom ‘skill’.

Now that my OpenHAB server has been moved in bluetooth range of the Echo, I was surprised how easy it was to pair my Ubuntu box with it and have the MaryTTS (separate web service, not the OH binding due to audio quality issues) play the audio back on the Echo. Combined with my custom skill, this allows people to, for example:

‘Alexa, ask Jarvis for a status update’

At which point the input and output all happens via the echo, input relayed through the cloud to my OpenHAB server, and MaryTTS replies with a spoken response of:

“Your home temperature is a comfortable 73 degrees, with a humidity of 40 percent. The Data Center peaked at 68 degrees today. There have been no security violations or vital infrastructure alerts. My battery backup is ONLINE at 100 percent capacity. At current load of 39 percent I can remain online for approximately 120 minutes in the event of a power outage.”

This also allows the OpenHAB server to ‘announce’ stuff on the Echo too via bluetooth, using the MaryTTS voice, as the OH rules are triggered. The advantage here is that it SHOULD still continue to work without relying on internet or even network connectivity (for push announcements only). No where near perfect, or a proper binding, but nifty nonetheless :slightly_smiling:

I intend to continue working on this as time permits, unless someone has a better way to tie the Echo into OpenHAB! Without the ability to push events to the Echo it seems this is the best that it can do


I picked up a Wemo Switch on sale and have to say the integration with Echo is pretty cool
 “Alexa, turn on the lounge fan”
 “OK”

Works a treat, now just wish I could saying something similar for my other OpenHAB controlled stuff instead of IFTTT and “Alexa, trigger lounge fan on”
 “Sending that to IFTTT”

Hi Guys,
I also have my Echo since a couple of weeks, and I managed to set the correct timezone with info found in this post that explain how to override the time zone id in order to have correct time functions on Echo (ask time, alarms, timer, etc
)
http://www.echotalk.org/index.php?topic=228.0
I live in Italy and now my Echo say the right time!!

Enjoy!

Hey, cool, that works - you made my day :slight_smile:

But this is working with the HA bridge mentioned at the top, so what are you missing?

@Kai did you have any specific ideas on how to tag items to expose them? Does this functionality already exist in OH2?

Currently I’m experimenting with some Java code that consumes an alternative REST voice engine API and fires requests to the openHAB REST API based on the results.

My stumbling block at the moment is resolving the json keywords extracted from the voice engine back to items or groups in openHAB in an intelligent way (for now this part is quite crude or hard coded in parts).

My two thoughts are:

  1. Configure the voice engine with enough context about the user’s openHAB setup such that the voice engine can resolve the speech to specific items/groups
  2. Be able to tag or label or name items in such a way that I can implement some kind of text search using Apache Lucene or something similar.

Thanks for that! Not sure how much success I’ll have but I’ll give it a go!