Official Alexa Smart Home Skill for openHAB 2

–Updated 5/31/2018, added new Languages and Regions –

I am pleased to announce that the openHAB 2 Alexa Smart Home skill has been certified by Amazon today and is now live. This skill allows you to connect your openHAB setup through the myopenHAB.org cloud service to Amazon Alexa. With this skill you can control items that respond to on/off and numeric commands as well as limited support for thermostats. The skill is supported for the following languages and regions:

English (UK)
English (US)
English (CA)
English (AU)
English (IN)
French (FR)
German (DE)

Some sample commands are:

Alexa, turn on Kitchen Light
Alexa, turn off Bedroom
Alexa, set Lights to 80 percent
Alexa, brighten Living Room
Alexa, dim Bedroom
Alexa, dim Kitchen by 20 percent
Alexa, brighten Great Room by x percent
Alexa, turn Bedroom light red
Alexa, set Thermostat to 22 degrees
Alexa, decrease Thermostat by 2 degrees
Alexa, increase Thermostat by 1 degrees
Alexa, decrease Thermostat
Alexa, what is Thermostat set to?
Alexa, what is Thermostat temperature?

Items that you wish to expose to Alexa will need to be tagged to identify what type of device Alexa will see them as. See http://docs.openhab.org/addons/io/homekit/readme.html for more information. Lighting, switchable and thermostat tags are currently supported (although not limited to those types of items). Thermostat control must use the Homekit style grouping to associate temperature, mode and set point, see the Homekit binding ReadMe above.

Some examples of tagged items are:

Switch KitchenLights "Kitchen Lights" <light> (gKitchen) [ "Lighting" ]
Dimmer BedroomLights "Bedroom Lights" <light> (gBedroom) [ "Lighting" ]

Group gDownstairsThermostat "Downstairs Thermostat" (gFF) ["Thermostat","Fahrenheit"]
Number DownstairsThermostatCurrentTemp "Downstairs Thermostat Current Temperature" (gDownstairsThermostat) [ "CurrentTemperature" ]
Number DownstairsThermostatTargetTemperature "Downstairs Thermostat Target Temperature" (gDownstairsThermostat) [ "TargetTemperature" ]
String DownstairsThermostatHeatingCoolingMode "Downstairs Thermostat Heating/Cooling Mode" (gDownstairsThermostat) [ "homekit:HeatingCoolingMode" ]

To install the app, add the openHAB skill through the Alexa application on your smartphone or web browser. Follow the prompts to connect the app to your myopenHAB.org account, then allow it to discover your devices.

Thermostat control is currently limited until we have a more complete ontology for tagging. There are a few caveats to keep in mind. First is that we assume temperatures are in Celsius unless the thermostat tagged group also contains the tag “Fahrenheit” (shown above). This is a temporary configuration and will hopefully change in the future. Second is that the Alexa skill expects the thermostat mode item (“homekit:HeatingCoolingMode”) to conform exactly to the strings “OFF, HEAT, COOL, AUTO, heat-cool” or “0,1,2,3”. Again this is a temporary restriction until a more complete solution is developed.

If you’re curious about the code running this skill or wish to contribute to its functionality, you may find it at https://github.com/openhab/openhab-alexa contributors are always welcome!

Thanks to everyone who helped out, keep up the good work!
Dan-

51 Likes

This is fantastic. I had been holding out on integrating Alexa with the Hue Emulation and will add this Skill later this evening.

My 6yr old already likes to say “Alex, play KidsBop” all day anyway, so this will just make my wife go crazy when my son starts messing with the lights too :slight_smile:

Is it possible to also control other items besides Lights? I have Zwave Switch for a ceiling fan and anything regarding Door Locks, Garage Doors, etc?

Very nice, thank you! Are there any big advantages over an existing Hue Emulation setup?

Thermostat control, easier setup (maybe?) are two advantages, and hopefully as Amazon expands the Smart Home Skill api, we can take advantage of it.

Sounds great! I will give it a try this weekend.

Works right out of the box!!! Thx a lot for this amazing new skill :heart_eyes:

2 Likes

Sure, just tag those On/Off switches with “Lighting” and you are good to go …

Any way to use this without myopenhab?

Can I add those tags to items created in PaperUI?

1 Like

Yes, the code is setup for self deployment, but this is very complicated due to the Alexa + oAuth + lambda environment. The Readme explains how to do this and references two Amazon docs which explain how to setup a Home Skill.

Unfortunately I don’t think the PaperUI has tag editing yet, but you can add tags via the rest api, goto the rest interface at http://yourhost:8080/doc/index.html and click on “items”, under that click on “PUT /items/{itemname}/tags/{tag}”, Enter the item name (case sensitive!) and tag name (also case sensitive!) and then click “try it out”.

5 Likes

I must be doing something wrong.

I enabled the Skill in the Alexa app and linked my myopenhab account. I also added [“Lighting”] to each of my lights in my items file and have those lights accessible in myopenhab as well but can’t seem to discover any devices.

sample of my items files

Color  FF_Light_FamilyLeft 			"Family Left"			(FF_Family, Lights, gdashboard)		["Lighting", "iss:room:FamilyRoom", "iss:type:DevRGBLight"]			{ channel="hue:0210:00178824e7e9:10:color" }
Color  FF_Light_FamilyRight 		"Family Right"			(FF_Family, Lights, gdashboard)		["Lighting", "iss:room:FamilyRoom", "iss:type:DevRGBLight"]			{ channel="hue:0210:00178824e7e9:11:color" }

I also tried with just [“Lighting”] removing the iss imperihome info but was also unable to discover them.

Any thoughts?

Also… on a side note. With already having Hue connected to Alexa, I assume you may end up with duplication and may need to decide what you want to include via the OpenHab skill vs the Hue Skill?

what is returned when you hit https://home.myopenhab.org/rest/items/FF_Light_FamilyLeft in your browser?

Yes, you will have multiple values, while you can delete those from the Alexa interface, I seem to remember they may get magically added back in due to automatic discovery.

Also I have noticed that if you have a large amount of items Alexa will say it does not find any, but if you go back to the Alexa app and look, it actually has found all of them.

This is what I get and I think its all looks correct?

{
  "link": "https://home.myopenhab.org/rest/items/FF_Light_FamilyLeft",
  "state": "82,55,100",
  "type": "Color",
  "name": "FF_Light_FamilyLeft",
  "label": "Family Left",
  "tags": [
    "Lighting",
    "iss:room:FamilyRoom",
    "iss:type:DevRGBLight"
  ],
  "groupNames": [
    "FF_Family",
    "Lights",
    "gdashboard"
  ]
}

Its a bug, I checked the code and we are adding Switch and Dimmer as accepted types but not Color. I just added https://github.com/openhab/openhab-alexa/issues/13

Ok.

I’m still struggling though. I’ve added [“Lighting”] to my remaining zwave switch light items and added them into myopenhab as well, but can’t find any devices in the app.

This is my Kitchen Light. Unsure if matters either, but I’m trying via an Android device. So unsure if anyone with IOS may see different results?

{
  "link": "https://home.myopenhab.org/rest/items/FF_Light_KitchenEating",
  "state": "ON",
  "type": "Switch",
  "name": "FF_Light_KitchenEating",
  "label": "Kitchen Eating",
  "tags": [
    "iss:type:DevSwitch",
    "Lighting",
    "iss:room:Kitchen"
  ],
  "groupNames": [
    "Lights"
  ]
}

I am still struggling with this “[ “Lighting” ]” notation.

I want to use the hue emulation side by side with the new alexa skill and would like to indicate which item should be handled by the hue emulation and which by the alexa smart home skill.

Is this possible?

Something like “[ “Lighting@hue” ]”.

1 Like

Thanks to the information in this thread setup was a breeze. This is awesome and your work is very much appreciated. This is much better than using IFTTT.

I’ll admit I didn’t fully read your first post and thought CurrentTemperature was a supported tag. Spent a bit of time confused, then ended up looking through the code and it appears that during discovery that tag is ignored. Was hoping I could ask Alexa the current temperature/humidity in different parts of my house. Is this something that is planned? I’m not familiar enough with Alexa and the API provided to understand the feasibility/scope of that work.

It’s not currently, but is something we should consider.