Official Alexa Smart Home Skill for openHAB 2

Thank you, I will dig into this.

I configured some alexa item switches and a harmony hub like this:

String hubCurrentActivity "Hub" <video> {channel="harmonyhub:hub:Wohnzimmer:currentActivity"}

Switch alexaFernseher "Fernseher" <television> [ "Switchable" ] 
Switch alexaNetflix "Netflix" <video> [ "Switchable" ] 
Switch alexaAufnahmen "Aufnahmen" <television> [ "Switchable" ] 
Switch alexaAmazon "Amazon" <video> [ "Switchable" ] 
Switch alexaSky "Sky" <video> [ "Switchable" ] 
Switch alexaSpotify "Spotify" <soundvolume> [ "Switchable" ] 

I created some alexa rules like this:

rule "Fernseher an/aus"
when
    Item alexaFernseher received command
then
    if (alexaFernseher.state==OFF) {
        hubCurrentActivity.sendCommand("PowerOff")
    }
    else if (alexaFernseher.state==ON){
        hubCurrentActivity.sendCommand("Fernsehen")
    }
end

rule "Aufnahmen an/aus"
when
    Item alexaAufnahmen received command
then
    if (alexaAufnahmen.state==OFF) {
        hubCurrentActivity.sendCommand("PowerOff")
    }
    else if (alexaAufnahmen.state==ON){
        hubCurrentActivity.sendCommand("Aufnahmen")
    }
end

rule "Netflix an/aus"
when
    Item alexaNetflix received command
then
    if (alexaNetflix.state==OFF) {
        hubCurrentActivity.sendCommand("PowerOff")
    }
    else if (alexaNetflix.state==ON){
        hubCurrentActivity.sendCommand("Netflix")
    }
end

rule "Amazon an/aus"
when
    Item alexaAmazon received command
then
    if (alexaAmazon.state==OFF) {
        hubCurrentActivity.sendCommand("PowerOff")
    }
    else if (alexaAmazon.state==ON){
        hubCurrentActivity.sendCommand("Amazon")
    }
end

rule "Sky an/aus"
when
    Item alexaSky received command
then
    if (alexaAmazon.state==OFF) {
        hubCurrentActivity.sendCommand("PowerOff")
    }
    else if (alexaAmazon.state==ON){
        hubCurrentActivity.sendCommand("Sky")
    }
end

rule "Spotify an/aus"
when
    Item alexaSpotify received command
then
    if (alexaSpotify.state==OFF) {
        hubCurrentActivity.sendCommand("PowerOff")
    }
    else if (alexaSpotify.state==ON){
        hubCurrentActivity.sendCommand("Spotify")
    }
end

I let alexa search for smart home devices (via the app). All the switches are listet.

The problem is that alexa only identifies Fernseher as valid switch. All the other switches are not recognized via voice control, allthough they’re listet in the app. The are visible via the rest service, And they’re all working via the OH sitemap.

Can somebody help?

First, the rule has nothing to do with Alexa as she really only sees a switch.
(only indirect when alexa recognizes the switches and the desired function wont work)

IMHO, as they appear in the alexa app, the problem lays in Alexa not OH?
Just for debugging try to rename e.g. “Netflix” to “Küche, Wohnzimmer, Bad” something that appears in the context of “normal” Smart Homes. Dont forget to delete all entries from alexa (via app) before searching again.

I also encountered a lot of problems with proper/personal names and names containing spaces.

@Rickecho
Just for debugging try to rename e.g. “Netflix” to “Küche, Wohnzimmer, Bad” something that appears in the context of “normal” Smart Homes. Dont forget to delete all entries from alexa (via app) before searching again.

I tried different names for the switches and indeed Alexa reacts now. Before I tried IFTTT and there these names were recognized (probably because of the trigger key word in front).

I found some hints of how to build valid invocation names here.

Good, also sometimes she has trouble with english pronounced words when set to german.

invocation names are for custom skills to activate them (ifft “trigger”, or “ask kodi to…”).
But I guess most rules are the same but definitely not all of them.

I think Amazon changed something this week.

I could use the follwoing commands fine before.
“Alexa, schalte Radio an” [= turn on radio]
“Alexa, Fahre Rolle auf 100%” [= drive roller shutter to 100%]

But now Akexa asks what radio channel I want to listen to.
And “I don’t know any device named ‘fahre rollo’”.

I guess I have to rename these items. :frowning:

Try “SETZE Rolladen auf x%” [= SET Shutter to x%]
As “fahre” seems to be not supported as far as I know: https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/smart-home-skill-api-reference#setpercentagerequest
Radio could indeed be a problem du to the build in tunein service.

Today “fahre” worked again.

Strange…

Hi.
Currently i’m using openhabian on Pine64 + Zwave switches + Sonos + Harmony Bridge + Hue + I/O SNMP, but on all versions released by Pine64 guys i have never succeed to discover any other item except my Hue Lights.

felling frustrated.

As reported over here, removing the thermostat tags solved the problem and my other Switchable device is now discoverable. Seems then to be an issue with Homekit Integration.

Create a new topic, mention PINE64 in the topic header to draw attention to other Pine users.
Provide a detailed description of what is not working, provide openhab.log (if possible in debug mode), start with the first, most important problem. If you put too much information in one topic you may not get the needed answers.

From what I have seen there are quite a few Pine users happy with openHAB.

So today all openhab items are gone from Alexa - even the hue emulation ones - I’m running nightly from 27th

Good news they are back again as LUX items

Like some others here, Alexa is unable to find my items with oH2.1 stable. (previously i was running oH2.1 snapshot)
I had a working configuration of a few items but decided to start over clean.

Alexa is connected to myopenHAB

myopenHAB is connected to my local openhab, i can get the items collection via the Rest Api

I even removed all my other items

This is the Switch, i want to be detected:

Switch KODI "Kodi [%s]"  ["Switchable"]

What am i doing wrong? Where should i look at?

Thanks for any input.

I have the same problem here. Since a fresh install with 2.1 I can’t get any item with Alexa. I removed every icon or group from the items. But nothing changes. myopenhab Cloud seem to be ok. I can see all items. I’m happy that I’m not the only one with this problem :blush: HomeKit works perfectly.

Did you do a complete fresh install including the internal databases or did you keep your config. I did the latter, i just removed all my items for testing purposes. My next step would be to clean everything and start just with a single item. But i hesitate to discover all 60something things again. (i use paperui for things & most of the bindings, everything else is in text files.)

Yes, I did a complete fresh install. Include all Bindings with PaperUi and configure my items via file. Even with only one item, Alexa find nothing. But HomeKit finds every item and works fine.

It would be a good idea to open an issue here

Did you check if it may be related to this existing issue

Yes, i did check. Removing all thermostat related tags didn’t help.

Yesterday i removed all my other items (renamed all text files to something other than *.items)

Today i removed all tags except for the single switch from the configuration. Did not help either.

Whenever i start a search within Alexa, my local openHAB logs the following:

2017-07-05 12:48:53.712 [DEBUG] [thome.io.rest.core.item.ItemResource] - Received HTTP GET request at 'items/'

I extended the logging this way:

log:set DEBUG org.eclipse.smarthome.io.rest

This is the same log entry i receive when i navigate to https://myopenhab.org/rest/items in a browser. Given the response time of below 1 second, latency shouldn’t be the issue as well.

Ive got the same problem - Im running 2.2 nightlies - the openhab skill isnt working with Alexa but it finds them with the Hue emulation - wouldnt say its fixed but atleast I can use Alexa to turn stuff on and off