Official Alexa Smart Home Skill for openHAB 2

sorry, copy paste issue

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

so i think I can see i might need this:

Rollershutter BR1_Blindtest "Test Blind [%d%%]" {alexa="RangeController.rangeValue" [category="INTERIOR_BLIND", friendlyNames="@Setting.Opening", supportedRange="0:100:100", unitOfMeasure="Percent", actionMappings="Close=100,Open=0,Lower=0,Raise=100)", stateMappings="Closed=100,Open=0"]}

Does that mean that infact I could put anything in there and it will respond to that word with that action? That is cool…

The documentation is clear about how to setup the RangeController semantic extensions. A number in parenthesis will be considered as an adjustment, otherwise as a set action.

Not sure what you mean by that. I would refer to the documentation as well.

OK thanks I have read the documentation but I just cant seem to understand it properly - I will try again, I think I dont quite get the principals.
I was meaning if i had an action mapping if “Close=100, Open=0, Icecream=0”
(im being silly but for an extreme example)
I could then say “Alexa, icecream the test blind” and it would set it to 0

Action and state mappings are part of the semantic extensions concept, which stipulates that it currently provides “Close”, “Open”, “Lower” and “Raise” interactions. So to respond to your original question, it is not possible.

I have got OH2.5 running on Rpi4 and now turned back to Alexa skill.

For mode controller I definitely cant say, for example, with mode setting OPEN=OPEN
‘OPEN device name’ I have to say ‘set device name to OPEN’ or ‘device name OPEN’

Also, I have problem with the room awareness. I am wondering if Alexa is being extra picky because I am using .de Echo in Austria but with language set to EN.

Another thought… I tried using for a dummy string supportedModes = “TOGGLE=OPEN, TOGGLE=CLOSE, TOGGLE=STOP” but seems I can’t have several commands resulting in the same action. In my example the switch is just a toggle switch and I only want to activate it with a rule.

Have you tried something like

String action1item "action1" {alexa="ModeController.mode" [supportedModes="action1=spokencommand1, action1=spokencommand2, action1=spokencommand3"] }

Then the one item would work for many commands

I have my RF blind working well for open/close/raise/lower states - any idea how I would implement “stop” as well?

OK that is how I have it now with a routine. I am trying to remove routines and use the new v3 stuff. I have sucessfully implemented the open and close but thought it would be “standard” of some type to have stop as well - although I understand the rangecontroller is designed as a custom type. Just thoguht someone else may have done this.

Unfortunately, Amazon didn’t include “stop” in their first iteration of the semantic extensions feature. So you will still need to use workarounds to control that action on the OH side via either Alexa routines or some of the solutions mentioned previously in this thread.

Gotcha, thanks for confirming, its great that this awesome skill is already this good

Would the skill improvements also include STOP for the toggle controller?

I have a for my garage a virtual switch item. When toggled to ON a rule checks if the alarm is on or not before sending the command to the real toggle switch.

The following item definition works nicely for my garage door for OPEN and CLOSE but not STOP voice commands. I have to use and Alexa routine for STOP.

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"}

When I try voice command for STOP Alexa indictaes it was accepted but nothing happens.

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