Official Alexa Smart Home Skill for openHAB 2

A switch item can only receive an ON or OFF command. So I am unsure what you are trying to achieve here. If you need STOP, you need to stick to a Rollershutter item modeled as ModeController configuration. Anyway, the documentation stipulates that you have to use a ModeController interface for garage doors, based on Alexa requirements, if you want to take advantage of the voice PIN open security feature.

The garage door switch is a toggle type. It needs to be ON only momentary and then its immediately OFF. So, the command is basically an ON with expire to turn it OFF after 1 second.

Press 1 door opens, press 2 door stops, press 3 door closes and then it cycles around. So what happens depends on where the door is at the time and not on the command.

In use via Alexa, rather than say toggle the garage door ON its better to say Open, Close, Stop and translate those commands to a toggle ON and immediate OFF via expire.

Of course its possible to say ‘close the garage door’ and if its already closed then it will open etc but in normal use the user knows where the garage door is so it doesn’t matter.

I don’t need the PIN security because the switch I use for Alexa is just a proxy switch. An openHAB rule is triggered when this is changed to ON and the rule then checks if my alarm is active or not. If its disarmed then it will issue the real toggle and the door opens.

I hope thats clearer. Thats why I actually just need to translate ‘open’, ‘close’ , ‘stop’ all to toggle an ON for the proxy switch.

You just described a Number item modeled as ModeController. As I mentioned before, a switch item can only have two states and can’t work for your use case.

Hi Jermey thanks for the suggestion. However, it is working except for stop and even that works if I create an Alexa routine.

Maybe I didn’t explain it well. Press 1,2,3 isn’t a number its just 1st On, 2nd ON, 3rd ON etc etc. The effect on the door is cyclic: open, stop, close, open, stop, close, etc. I just need an ON. An Expire timer resets it to OFF after 1 sec.

Also, as I have said before, for the mode controller I cannot say ‘STOP the garage door’ I have to say ‘set the garage door to STOP’. I am not sure why its like that for me as others say it does work both ways for them. The only reason I can think of is that I have Alexa.de but in English langauage.

If you could provide the actual item definition you are using to control your garage door on the OH side, that would help understand what you are trying to achieve.

I have created the below Alexa feature request to extend semantic extensions support for “start”, “stop”, “pause”, “resume” commands. Make sure to vote for it if you are interested.

3 Likes

Hi Jeremy,

Voted.

My garage door is a side sectional type which means sometimes I only want to open it partially for quick access. So STOP is useful when its opened just enough.

Actual door switch

Switch GarageDoor_Toggle "Garage door toggle" <garagedoor> {channel="openwebnet:bus_on_off_switch:Screen10:xxxx:switch", expire="1s,command=OFF"} //Toggled via rule

Proxy switch

Switch GarageDoor_VirtualSwitch "Garage door" <garagedoor> {alexa="ToggleController.toggleState" [category="GARAGE_DOOR", friendlyNames="@Setting.Opening", actionMappings="Stop=ON,Close=ON,Open=ON", autoupdate="true"], expire="1s,command=OFF"}

Rule to check alarm state before opening door and issue warnings if attempted while alarm is active

rule "Garage door"
when
    Item GarageDoor_VirtualSwitch changed to ON
then
    val mailActions = getActions("mail","mail:smtp:xxxx")
    if (AlarmArmed_Sensor.state==OFF) {
        GarageDoor_Toggle.sendCommand(ON)
    }
    else {
        EchoShow1_Announcement.sendCommand('Warning. The garage door cannot be opened while the alarm is armed')
        sendNotification(xxxx','Warning: Garage door commanded to open with alarm active')
        logInfo("alarm" , 'Warning: Garage door commanded to open with alarm active')
        mailActions.sendMail('xxxxxx', 'Alarm warning', 'Warning. Garage door commanded to open with alarm active')
    }
end

So after going over your previous explanation, I now understand the setup. My initial comment still stand. You have to use a ModeController. Keep in mind that if you are using category GARAGE_DOOR, you will have to use the new open by voice pin feature. If you don’t want to use it, use category DOOR.

item

String GarageDoor_VirtualSwitch "Garage door" <garagedoor> {alexa="ModeController.mode" [category="GARAGE_DOOR", friendlyNames="@Setting.Opening", supportedModes="ON=@Value.Close:@Value.Open:Stop,OFF=Reset", actionMappings="Close=ON,Open=ON"], autoupdate="false"}

rule

rule "Garage door"
when
  Item GarageDoor_VirtualSwitch received command ON
then
  ...
end

commands
“Alexa, open garage door”
“Alexa, close garage door”
“Alexa, set garage door to stop”

Hi Jeremy,

That also works but only if I remove :

category="GARAGE_DOOR"

If it is left in then Alexa says ‘garage door doesn’t support that’ for open, close and stop.

Also, when setting up an Alexa routine the devices list shows garage door as unsupported as do all my blinds now. I presume something changed and the modecontroller parts are longer working for the office blind stop workaround

Same here …

Creating Alexa routines…I checked again today and now all the previously unsupported devices are supported; except my IP cameras. I didn’t change anything.

1 Like

I am trying to get the same working as you. Also in german.

This is my current item:

Rollershutter Wohnzimmerrollo "Wohnzimmerrollo" (gWZR) {alexa="RangeController.rangeValue" [category="INTERIOR_BLIND", friendlyNames="@Setting.Opening", supportedRange="0:100:10", unitOfMeasure="Percent", actionMappings="Close=100,Open=0,Lower=(+10),Raise=(-10)", stateMappings="Closed=100,Open=0:100"]}

Auf/zu/schließen/öffnen is working.
But the “hoch” and “runter” commands are not supported (that’s what alexa says). How do I get them to work ?

Bonus question: When I try to set a percentage then I get also the message that the command is not supported. What am I doing wrong?

doesn’t look right. Anything other than 100 should be ‘open’. So, like this,

stateMappings="Closed=100,Open=0:99"
1 Like

Thank you I made that change.
Any hints/tips how I could get the other functions working via Alexa ?

Apart from stopp it should work. I used category as exterior blind. Not sure if that could be the problem.

Stopp needs the group and modecontroller work around

I just tested it with setting as exterior blind but I get the same message from Alexa.
Any suggestions what I could try ?

Raise and Lower work for me. The only other difference from my item definition is that I don’t use the friendly names setting

Hello guys,

this is my current items file and everything is working perfectly execpt “Höher” (Raise) and “Tiefer” (Lower). It is inverted. (“Höher” and “Tiefer” are german words)

Group gWZR                   "Wohnzimmer Rollo"                {alexa="Endpoint.INTERIOR_BLIND"}

String Wohnzimmerrollo_stop   "Stopp"       (gWZR)  {alexa="ModeController.mode" [supportedModes="STOP=stopp,UP=0,DOWN=100", autoupdate="false"]}

Rollershutter Wohnzimmerrollo  "DummyName Rollo" (gWZR)  {alexa="RangeController.rangeValue" [category="INTERIOR_BLIND", friendlyNames="@Setting.Opening",supportedRange="0:100:10", unitOfMeasure="Percent", actionMappings="Close=100,Open=0,Lower=(+10),Raise=(-10)", stateMappings="Closed=100,Open=0:99", itemSensor="WohnzimmerrolloLinks_Position"]}

I tried both of these settings Lower=(+10),Raise=(-10) and Lower=(-10),Raise=(+10) already. It still does it inverted.
When I say tiefer (lower) it goes up and if I say höher (raise) it goes down.

Any suggestions on what to try ?

Hey, did you manage to find a solution for this?
I’m also looking for a solution to send TOGGLE command to OH item.

Hi @jeshab,

I am trying to get my garage door to open and close and report its state. I will add STOP later :wink:

I have a switch item that toggles the garage door opener in a sequence as follows : open, stop, close, stop, open, stop, close etc etc. ie what it actually does depends on the current state and previous direction. The switch is only ever on for 1 second.

I also have a seperate door sensor item that is ON=door closed, OFF=door open

I am trying to use the itemSensor to track the door status.
I have defined these two items. The garage door virtual switch does not toggle the door directly but triggers a rule which then checks my house alarm state before toggling the actual switch item.

Switch GarageDoorClosed_Sensor "Garage door sensor [MAP(GarageDoorPosition.map):%s]" <GarageDoor> {channel="openwebnet:bus_dry_contact_ir:gateway:xx:sensor"}

Switch GarageDoor_VirtualSwitch "Garage door [%s]" <garagedoor> {alexa="ToggleController.toggleState" [category="GARAGE_DOOR", itemSensor="GarageDoorClosed_Sensor", actionMappings="Close=ON,Open=ON", stateMappings="Closed=ON,Open=OFF", autoupdate="true"]}

In the documentation there is this sentance

It is important to note that sensor items need to be the same type than their parent item, except for LockController capable items. Additionally, since deferred reporting is not supported by the skill as of yet, their state will need to be available right away for the skill to report the device latest status.

The bit in bold doesn’t make sense. What should it say?

So far some progress:
If I ask Alexa to close or open the door she does although its only toggling the switch so the door direction depends on its initial state. If ask ‘Is the garage door open’ she responds as follows:

‘Garage door garage door is ON’ I am not sure why she does not say closed as per the stateMappings nor why she repeats the item name.

Maybe what I want is better achieved another way??? eg rules and more virtual items. I also have another sensor thats reports if the door is moving or not. So, I have all the information I need to perform a voice command for Open, Close and Stop command without needing to know the initial state myself.