Official Alexa Smart Home Skill for openHAB 2

Ah ! Thanks @jeshab ! Seems interesting !

@hairdresser Any chance you could do the testing I mentioned above? I would like to know if you get the same result than I did. Thanks!

Item
(Appended language parameter to force French language on that item for testing consistency)

Rollershutter AX_DW_mRDC_Salon_volettest "Salon Volet" {alexa="RangeController.rangeValue" [category="EXTERIOR_BLIND", supportedRange="0:100:10", unitOfMeasure="Percent", actionMappings="Close=0,Open=100,Lower=(-10),Raise=(+10)", stateMappings="Closed=0,Open=1:100", language="fr"]}

Simulator
(Brief mode is enabled on my account; that’s why there is an “Audio only response” on acknowledgement)

Events

2019-12-30 21:15:39.167 [ome.event.ItemCommandEvent] - Item 'AX_DW_mRDC_Salon_volettest' received command 100
2019-12-30 21:15:39.168 [vent.ItemStateChangedEvent] - AX_DW_mRDC_Salon_volettest changed from NULL to 100
2019-12-30 21:15:45.641 [ome.event.ItemCommandEvent] - Item 'AX_DW_mRDC_Salon_volettest' received command 0
2019-12-30 21:15:45.642 [vent.ItemStateChangedEvent] - AX_DW_mRDC_Salon_volettest changed from 100 to 0
2019-12-30 21:15:55.502 [ome.event.ItemCommandEvent] - Item 'AX_DW_mRDC_Salon_volettest' received command 100
2019-12-30 21:15:55.502 [vent.ItemStateChangedEvent] - AX_DW_mRDC_Salon_volettest changed from 0 to 100
2019-12-30 21:16:05.014 [ome.event.ItemCommandEvent] - Item 'AX_DW_mRDC_Salon_volettest' received command 0
2019-12-30 21:16:05.015 [vent.ItemStateChangedEvent] - AX_DW_mRDC_Salon_volettest changed from 100 to 0

How do you tell alexa to activate the stop mode?
I have configured it like you, in the alexa app I see the mode stop, up and down. I can select it and I see the change in the openhab log. But I am not able to tell alexa to do so :slight_smile:

Edit:
Now I got it :heart_eyes:
Your example is an english one. In my case alexa understand “stopp” (german) and your example uses stop.
For all german ones, here my setup + commands:

Group gEins                   "eins"                {alexa="Endpoint.EXTERIOR_BLIND"}
String Rollo_WZ_klein_stopp   "halt"       (gEins)  {alexa="ModeController.mode" [supportedModes="STOP=stopp,UP=auf,DOWN=zu", autoupdate="false"]}
Rollershutter Rollo_WZ_klein  "eins Rollo" (gEins)  {alexa="RangeController.rangeValue" [category="EXTERIOR_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"],channel="loxone:miniserver:.." }
  • schliesse eins (close eins) → full close
  • oeffne eins (open eins) → full open
  • setze eins auf xx% (set eins auf xx %) → moves to % value
  • fahre eins hoch (raise eins) → moves up by 10%
  • fahre eins runter (lower eins) → moves down by 10%
  • eins stopp (oder: setze eins auf stopp) (set eins to stopp) → STOP mode is selected

For setting modes (mode controller item) you need to say it like this: ‘Set item name to STOP’.
If you want to say it like: ‘STOP item name’, then you need to create an Alexa routine for that phrase.

is it possible to send an openhab voicecommand to Alexa same as I would do when I command her by voice?
example: when echo spot is streaming radio, the display just shows the boring radio logo but the clock disappears. I need to call “Homescreen” to get back the clock display.
it would be great if I could sendcommand “Homescreen” to an item.
any idea?

For echo device control, you should check the Amazon Echo Control binding and its relevant community thread.

Hi

Is there a list of allowed endpoint names? I looked but I didn’t find one.

edit I think I found it… The allowed endpoint names are the same as those used for the display category

display-categories

@wawa79 @hairdresser So the latest update, related to the support case I have opened with Amazon, is that specific words need to be part of the device name, along with the usage of preposition, for the French and most likely other latin-based languages. This is something that I noticed in my testing above.

Therefore, for the French language, in order to prevent the capability overlapping issue, you will need to include the word “Volet”, “Store” or “Rideau”, for blinds, and “Porte”, for doors, in the device name. If you only have one device, you can just name it based on these words only. For composed names (e.g. “Salon Volet” or “Cuisine Store”), you will need to use a preposition “de” or “du” (e.g. “ouvre le volet du salon” or “ferme le store de la cuisine”).

It’s obviously not ideal especially since there are no device name restrictions with raise and lower semantic action requests but unfortunately, this is how Amazon implemented.

1 Like

The amazon link points to .com. I couldn’t add a review there, don’t spend enough there, but did so at .de , in English :slight_smile:

1 Like

Did you create for each blind an own stop rule?

I tried to solve this with one general rule. The item names of each group have the same name + the stop item has an additional “_stop” string.
If a member of a group receives the STOPP command, I get the item name via triggeringItem and remove the “_stop” string. So I get the real rollershutter item name and can use it to send the stop command.

Item/Group definition:

Group gName "group name" { .....

String test_stop "name1" (gName) {....
Rollershutter test "name2" (gName) {....

String test2_stop "name10" (gName) {....
Rollershutter test2 "name20" (gName) {....

....

Rule definition:

rule "stopp"
when
  Member of gName received command STOPP
then
val itemName = triggeringItem.name.replace("_stop", "")
sendCommand(itemName, "STOP")
end
1 Like

I have 19 blinds and only set up the STOP for 2 of them where its most useful. Plus an Alexa Routine to make the phrase ‘STOP blind’ work instead of ‘set blind to STOP’. I like your idea though.

I modified to code to make it work with my previous example and added some logging

This line needed the .toString to make it work

sendCommand(itemName.toString,'STOP')

.item

Group:String gShutterCommand  "Shutter command group"  // for Alexa STOP command rule

Group OfficeBlind "Office blind" {alexa="Endpoint.EXTERIOR_BLIND"}
    String OfficeShutter_Command "Office shutter command" (OfficeBlind,gShutterCommand) {alexa="ModeController.mode" [supportedModes="STOP=STOP,UP=UP, DOWN=DOWN", autoupdate="false"]} 
    Rollershutter Office_RollerShutter "Office shutter [%d %%]" <blinds> (OfficeBlind,gAllBlinds) {alexa="RangeController.rangeValue" [supportedRange="0:100:10", unitOfMeasure="Percent", actionMappings="Close=100,Open=0,Lower=(+10),Raise=(-10)", stateMappings="Closed=100,Open=1:100"], channel="openwebnet:bus_automation:Screen10:55:shutter" }

.rule

rule "STOP command"
when
    Member of gShutterCommand received command STOP
then
    val itemName = new StringBuilder()
    itemName.append = (triggeringItem.name.replace("Shutter_Command", ""))
    itemName.append('_RollerShutter')
    sendCommand(itemName.toString,'STOP')
    logInfo("Blinds", "STOP command sent to "+ itemName )
end

Blind stops. Log shows:

[INFO ] [clipse.smarthome.model.script.Blinds] - STOP command sent to Office_RollerShutter
2 Likes

You defined the group “gBlindCommand”, I assume you mean “gShutterCommand” - this group is used by

String OfficeShutter_Command "Office shutter command" (OfficeBlind,gShutterCommand) {alexa=...

Thanks I fixed it. I tidied up my posted test code and missed that bit.

Alexa seemed to understand more reliably when I used for the group name something very different from that used for the group member names. Hence the the use of ‘Shutter’ and ‘Blinds’ in the names. I need to test if this really matters a bit more.

Also, I like my item names to give some idea of their type and or function. It makes a bit easier to follow the code for rules.

I was playing a little bit with nested group definitions for the rollershutters in combination with alexa - but it does not behave as expected.

For example, I have two rollershutter groups (including String + rollershutter item) gRS_living1 and gRS_living2. These groups I want to have again combined in another group gLivingroom.

From alexa point of view I want to be able to trigger each single group + to be able to trigger both groups with the global gLivingroom group.

Group  gLivingroom    "Livingroom"      {alexa="Endpoint.Other"}

Group gRS_living1 "Shutter 1" (gLivingroom) {alexa="Endpoint.Other"}
String living1_stop (gRS_living1) ".." {alexa="ModeController.mode"
Rollershutter living1 (gRS_living1) ".." {alexa="RangeController.rangeValue" ..., channel=".."}

Group gRS_living2 "Shutter 2" (gLivingroom) {alexa="Endpoint.Other"}
String living2_stop (gRS_living2) ".." {alexa="ModeController.mode"
Rollershutter living2 (gRS_living2) ".." {alexa="RangeController.rangeValue" ..., channel=".."}

With this setup I do not get groups in the alexa app, I see as devices both rollershutter items and strings: living1 , living1_stop , living2, living2_stop

I expected to see group gLivingroom, gRS_living1 and gRS_living2

Is it possible to create nested groups in combination with alexa tags?

What do you see with just the top level group as endpoint.other? Also, I wonder if clearing the cache would help.

edit… I have a lot of devices but I can see something is not quite right with the Alexa list of devices. For one the web page list is different from the phone app list. I have so much stuff its not easy to spot a pattern but I do see extra ‘Roller shutter’ devices in the phone app and in the web page like this

For web page only I see two extra smart devices too.

Blind groups are clearly identified as groups in browser but not in the phone app. In the phone only you can dig into the devices settings and see if its a group or not. If group then you see SET and Percent options. Type was listed as ‘other’ and not EXTERIOR_BLIND as in item definition.

So, the device lists are a bit of a confusing mess not helped by the different functionality, experience between the browser Alexa web page vs the Alexa phone app

If your question is about having a group endpoint include other group endpoints, then the answer is no. You can model a group item with a defined type as a single endpoint that would control all the items linked to that group. Or you can just setup a group on the Alexa side.

As a side note, you should set your group endpoint with a proper display category (INTERIOR_BLIND or EXTERIOR_BLIND and if using camel case format Endpoint.InteriorBlind or Endpoint.ExteriorBlind).

Group gLivingroom "Livingroom" {alexa="Endpoint.ExteriorBlind"}
Group:String gRS_living_stop (gLivingroom) ".." {alexa="ModeController.mode" ...}
Group:Rollershutter gRS_living (gLivingroom) ".." {alexa="RangeController.rangeValue" ...}

Group gRS_living1 "Shutter 1" {alexa="Endpoint.ExteriorBlind"}
String living1_stop (gRS_living1, gRS_living_stop) ".." {alexa="ModeController.mode" ...}
Rollershutter living1 (gRS_living1, gRS_living) ".." {alexa="RangeController.rangeValue" ..., channel=".."}

Group gRS_living2 "Shutter 2" {alexa="Endpoint.ExteriorBlind"}
String living2_stop (gRS_living2, gRS_living_stop) ".." {alexa="ModeController.mode" ...}
Rollershutter living2 (gRS_living2, gRS_living) ".." {alexa="RangeController.rangeValue" ..., channel=".."}
2 Likes

I managed to remove my spurious roller shutter items and clear up a few other oddities by commenting // out the blind groups and their items. Then on Alexa side >> Forget all, Discover. I removed the commenting // and then ran Alexa Discovery again. now I just see the Blind groups.

They still show as type ‘other’ in the devices settings in the App. Where is the display/endpoint category used? Under devices in the app I only have Echo&Alexa, Lights, Switches, Cameras and All.

Thank you @jeshab!
Your proposal is exactly doing what I have expected :heart_eyes:

With “our” setup it is also possible to say:
item name stop
without creating a routine!

You can also do this to remove routines (a nice little workaround I discovered last night):