Amazon Echo Skill for OpenHAB available!

root@maggie alexa-utterances # patch -p1 < 8599208037ada7020a3ab8c6fc979e31a2ff934c.patch
patching file README.md
patching file index.js
can’t find file to patch at input line 100
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

|diff --git a/test/index.js b/test/index.js
|index b82500f…2e905b3 100644
|— a/test/index.js

+++ b/test/index.js

File to patch:
Skip this patch? [y] n
File to patch: ^C

DOH! OK, trying to reproduce this now…

Looks like just a test file that was deleted.

Exactly :slight_smile:
Remove the test.js portion in the patch file (bottom), and it works!

I’ve created an issue for this, and uploaded a working copy of the patch. I’ve also requested the author to apply it to master/npm! Also updated the Alexa-HA documentation on how to apply the patch here.

Thanks!

Have you tried this on any port other then 443? When I try 443 I see Amazon hitting my box (fails because app is on 30000), but when I setup https://maggie.robotics.net:30000/api/alexa/alexa-ha I never see it hit my box…

Unfortunately, it seems to require 443 at the moment!

https://forums.developer.amazon.com/forums/thread.jspa?threadID=10265

Ah!! ok, I will make that change… At least I am not going crazy, I did see you hit it. :slightly_smiling:

Giving up for the day, I get the following error on my iphone echo app:

The SSL handshake to endpoint Resource [https://maggie.robotics.net/api/alexa/Alexa-HA], Type [HTTP] failed. Please check that your java keystore is correctly configured.

The odd part is that I can pull it up in Chrome and Firefox and I get the green lock so my cert looks good to me. I have no clue what that [HTTP] part is, I have https checked…

:frowning: SSL setup can definitely be a pain. The issue appears that you do not have an intermediate cert setup:

https://www.sslshopper.com/ssl-checker.html#hostname=https://maggie.robotics.net/api/alexa/alexa-ha

I’ve also seen some reports of ASK developers having issues with wildcard certs or certs issued from non trusted CA authorities. Ultimately you don’t really need all that - I bet you could just self sign it and upload the SSL cert to your custom AWS ASK Skill.

This is probably what you need - to add the intermediate cert into the chain in Alexa-App-Server… Not seeing exactly how to do that though, in its config…

Anyhow, I would recommend just falling back to self signing and being done with it for now :slight_smile:

Thanks, tried that, all green now but still no joy. I will try self signed tomorrow.

Hi Mike,

Currently you request to set the item names in the config file. Wouldn’t it be more accurate to get the items by http request and then trying to match the item to the user request?

Getting the same error with self signed. Must be something with Apache config, any way to just specify my certs in alexa-app-server, would take a link out of the chain that is not needed.

Have you tried removing the alexa-app-server modification we made to index.js, which sets the listen IP address? I would do that first and restart. Here are some other things to look into as well:

"SNI was now enabled and I didn’t have ServerName set in my ssl.conf. Once I set ServerName it started working again."
https://forums.developer.amazon.com/forums/thread.jspa?threadID=11319&tstart=0

"Alexa’s lack of support for SNI. "
https://forums.developer.amazon.com/forums/message.jspa?messageID=16266

All the best,
-Mike

I want to hit my head against the wall!!! I googled and screwed around with this for hours! Thank you so much, that was the issue, I put back my real certs and everything works great!

Few questions:

  1. Is the next step to make this a binding? Right now I only have office lights working, but I have hundreds of items I would like to configure. I would think that if it was a binding it could have access to that and not need that part of the config.

  2. Would really like to get rid of Apache. Is it that much work to be able to specify certs?

  3. I see that all your key words are one word, how would I make it work with Joshua, Emma’s, Master bedroom?

  4. Any any any way to get rid of ask OpenHAB?

  5. When OpenHab is at my service, any way to ask more then one command without having to ask openhab again?

Good work, I like it.

Excellent! Glad you managed to get it all setup! :sunglasses: To answer your questions:

  1. Sort of, because we can’t make the Echo ‘announce’ stuff, it would be more of an IO add-on than a binding. I have had a side discussion already with the ‘powers that be’ about publishing it as an official OpenHAB Skill, and potentially adding it as a new feature to my.OpenHAB.org. A lot of work will be needed to have a single Skill that supports all houses, create a Web UI for setting up the item->location->name mappings, address all security concerns and make it reusable as possible without much end user configuration…

  2. I will experiment tonight using only NodeJS/Express and self signed certs, and let you know the outcome.

  3. Mine are single words for simplicity, but two words should work the same. The important part is that you update the ASK LOCATION_TYPE ‘custom slot’ to perfectly match what you want… Then, maybe enable some of the console.log DEBUG lines in the index.js code so you can see exactly what Alexa ‘heard’ when the intent is hit. Note that the Alexa-HA code strips the dangling word ’ room’ from the location names (So ‘living room’ becomes ‘living’, but ‘bedroom’ remains ‘bedroom’).

  4. Not today, this is required for any custom Skill AFAIK… I believe the ‘big’ vendors like Philips/Samsung/Wemo/etc must have struck a relationship with Amazon to get the deeper integration (with out ‘ask …’). As this project matures I intend to request the same! The reason the Amazon Echo HA Bridge can do it is because its simply emulating a Hue bridge…

  5. I am working on that. I initially had it wired it in so Alexa-HA ‘reprompts’ the user after each command. For example, say ‘Alexa, open OpenHab’ and wait. After 10 seconds it will ask you again. That because awkward to use when enabled for every command, so I took it out last minute. Ideally I want to find a way to issue many commands all at once, like ‘Alexa tell OpenHab to turn on the office lights, office fan, office PC’, etc.

And again, thanks for your donation! Part of that has already been used to pre-order the new Echo Dot so I can begin testing with multiple Echo’s in the house, and teach Alexa how to control everything in the home theater :slight_smile:

Lots more to do, but its certainly coming together well! Be sure to keep an eye on the development branch where all the latest and greatest improvements are being worked on:

I thought of that too during initial development, and have a TODO for automatic discovery via ‘/rest/items’. The problem I ran into with this, which is why I ended up doing it via Alexa-HA configuration, is the item names could be set to anything (i.e. arbitrary, varying between OpenHAB setups) in your OpenHAB items file. Alexa-HA needs to know what/where before it can issue an action, and to handle edge cases (i.e. multiple lights in a room you want to control individually), I found it to be more flexible AND reusable for everyone this way. Albeit more of a pain to get setup, though :slight_smile:

Got this working - Node.js/Express.js only with a self signed certificate; no Apache. Wrapping up the documentation on how to do it now!

Done! Still needs some TLC but this QUICKSTART guide explains how to deploy Alexa-HA using the Semi-Direct method (i.e. Echo -> AWS ASK -> NodeJS/Express -> HA).

I looked at this, I think it would work if you could get descriptions, but it looks like you only get item names over rest and I am not sure that is what we are looking for. Does anyone know if a binding has access to item descriptions?

Dimmer	Master_Bedroom_Recessed_Master	"Master Bedroom Recessed Lights [%s %%]"		(Master_Bedroom, Light)		{insteonplm="3B.AE.D7:F00.00.01#dimmer,related=3B.D1.95,related=3B.B1.51"}
Dimmer	Master_Bedroom_Recessed_Slave	"Master Bedroom Recessed Lights [%s %%]"		(Master_Bedroom, Light)		{insteonplm="3B.D1.95:F00.00.01#dimmer,related=3B.AE.D7,related=3B.B1.51"}
Dimmer	Master_Bedroom_Recessed_Slave_2	"Master Bedroom Recessed Lights [%s %%]"		(Master_Bedroom, Light)		{insteonplm="3B.B1.51:F00.00.01#dimmer,related=3B.AE.D7,related=3B.D1.95"}
Dimmer	Master_Bedroom_Light_Master	"Master Bedroom Light [%s %%]"				(Master_Bedroom, Light)		{insteonplm="3B.B8.0F:F00.00.01#dimmer,related=3B.B4.53,related=3B.BF.AC"}
Dimmer	Master_Bedroom_Light_Slave	"Master Bedroom Light [%s %%]"				(Master_Bedroom, Light)		{insteonplm="3B.B4.53:F00.00.01#dimmer,related=3B.B8.0F,related=3B.BF.AC"}
Dimmer	Master_Bedroom_Light_Slave_2	"Master Bedroom Light [%s %%]"				(Master_Bedroom, Light)		{insteonplm="3B.BF.AC:F00.00.01#dimmer,related=3B.B8.0f,related=3B.B4.53"}
Dimmer	Master_Bedroom_Fan		"Master Bedroom Fan"			<fan>		(Master_Bedroom, Fan)		{insteonplm="25.0E.40:F00.00.15#loaddimmer"}
Dimmer	Master_Bathroom_Light		"Master Bathroom Lights [%s %%]"			(Master_Bedroom, Light)		{insteonplm="3B.B5.CA:F00.00.01#dimmer"}
Switch	Master_Bathroom_Fan		"Master Bathroom Fan"					(Master_Bedroom)		{insteonplm="3B.9D.F9:F00.00.02#switch"}
Dimmer	Master_Bathroom_Vanity_Light	"Master Bathroom Vanity Lights [%s %%]"			(Master_Bedroom, Light)		{insteonplm="3B.C7.73:F00.00.01#dimmer"}
Dimmer	Master_Bathroom_Shower_Light	"Master Bathroom Shower Light [%s %%]"			(Master_Bedroom, Light)		{insteonplm="3B.BA.2c:F00.00.01#dimmer"}
Dimmer	Master_Bathroom_Bath_Light	"Master Bathroom Bath Light [%s %%]"			(Master_Bedroom, Light)		{insteonplm="3B.B9.62:F00.00.01#dimmer"}

I guess that even if you had descriptions that I would run into problems because I have several items with the same Description. I think the best approach would be to add a new item field for speech tag. You could add it just to the items you want and then the binding could see all of them without binding specific config.