[SOLVED] Fine tune Amazon Alexa Smart Home Skill

Hello. I have currently installed the myopenHAB.org cloud service to use Amazon Alexa to give commands. This works great for switching lights, but for some blinds I would like to expose a different functionality, like the one I have exposed through a sitemap.

Let me show you a simplified version of what I got so far:

// default.items
Switch Light1 "the Light" <switch> {channel="zwave:...", alexa="PowerController.powerState"}

Rollershutter Blinds "the Blinds" <rollershutter> { channel="zwave:...", alexa="PercentageController.percentage"}
Dimmer Slats_Tilt "the Tilt" <slats> {channel="zwave: ...", alexa="PercentageController.percentage"}
// default.sitemap
sitemap default label="home" {
    Switch item=Light1

    Default item=Blinds
    Switch item=Slats_Tilt mappings=[50="open", 35="light", 0="closed"]
}

The last sitemap entry exposes the slats as a three-way switch for three predefined tilts. I would like to expose these friendly names via Alexa.

What currently works are commands like these:
“Alexa, turn th light on/off!”
“Alexa, set the Blinds to 50 percent!”
“Alexa, set the Tilt to to 35 percent!”

However, I want to work with the mapped names and be able to request things like:
“Alexa, set the tilt to light!”

Has anyone achieved this, or some advice how to make this possible?

You should use the range controller interface associated to a group endpoint to achieve this. Keep in mind that the current version of the live skill only supports that interface in the US but this will be expanded to the other regions very soon.

As a side note, no need to specify “the” in your item label. Alexa language processing handles these words. The configuration below will basically roll the two capabilities into one group device. So you will need to remove the previous two devices that were discovered related to these functionalities from your Alexa account.

Also, since it seems the tilt on your blinds are limited to a range from 0 to 50%, I specified that range limit in the item alexa metadata parameters. That way, if you request for a number above that limit, you should get a number out of range error response.

Rules

Group gBlind "Blinds" {alexa="Endpoint.InteriorBlind"}
Rollershutter Blinds "Blinds Opening" <rollershutter> (gBlind) {channel="zwave:...", alexa="RangeController.rangeValue" [friendlyNames="@Setting.Opening", supportedRange="0:100:1", presets="0=@Value.Close:Closed,100=@Value.Open", unitOfMeasure="Percent"]}
Dimmer Slats_Tilt "Blinds Tilt" <slats> (gBlind) {channel="zwave: ...", alexa="RangeController.rangeValue" [friendlyNames="Tilt", supportedRange="0:50:1", presets="0=@Value.Close:Closed,35=Light,50=@Value.Open", unitOfMeasure="Percent"]}

Utterances

Alexa, set the blinds opening to 50 percent
Alexa, set the blinds tilt to 35 percent
Alexa, set the blinds tilt to light

(If you only setup this device once on your account, you should be able to get away by not calling the device name: Alexa, set the opening to 50 percent)

2 Likes

Thank you very much, I implemented this but as you stated, It does not work for me currently, as I’m located in Germany, but still your detailed comment has been most helpful. I guess I will have to wait.

The documentation for the alexa skill is quite confusing to me. Hence, I have some questions regarding that:

  1. In the presets string, what do I do with the “@” prefix? Does this correspond to the mapping names in the sitemap? E.g., if I had
// default.sitemap
sitemap default label="home" {
    Switch item=Slats_Tilt mappings=[17="somename", 81="othername", 0="closed"]
}

could I format to

... presets="17=@Value.somename:FriendlyNameforSomename,81=@Value.othername:FriendlyNameForOtherName,0=@Value.Close:FriendlyNameForClose"

or are these only for special fixed endpoints?

  1. Do you have any estimate, when the rangeController will be available id Germany? When I drop the group, I can have these [aspects of the same device] as different items, and there I can actually use the rangeController.

You have to define one or more friendly names (aka labels), delimited by “:”, for each presets that you can use to request a preset to be set to. Same goes with the capability friendly names. There are two types of labels you can specify. The first one is a simple text label localized in your own language and the second one is to use one of the asset ids provided by Amazon.

The asset ids are prefixed with “@” and I would recommend using these over text labels if the term you would like to use is included in the asset catalog. The idea behind this is that Amazon expands, on their end, each asset ids into a list of pre-defined friendly names and their localized translations, based on the language your echo device is configured. This means that if you use @Value.Close, Alexa language interpretation would be able to understand “Close” in English, “Schließen” in German, “Ferme” in French, and so on…

So going back to my example presets="0=@Value.Close:Closed,35=Light,50=@Value.Open", I added Closed to the “0” preset label list, in line with your sitemap configuration, because it is not included in the asset id @Value.Close. However, now that I think about it, you could probably remove it and just use the asset id alone for that preset as the Alexa language processing will most likely be able to understand it anyway. Likewise, I just used text label Light for the “35” preset because there isn’t an asset id that cover that name as of yet.

Using your example, assuming that the first two mappings don’t have relevant asset ids, the presets metadata parameter would be: presets="17=somename,81=othername,0=@Value.Close"

Since you are located in Germany, I would recommend, if not already done, that you name your Alexa-linked item labels and text-based friendly names in your own language, unless you have set your echo devices to English language.

You can watch the issue below. The change has been implemented. So it shouldn’t take too long before it is available in the live skill.

I am not sure to follow what you are trying to ask here. A group endpoint allows you to bundle several capabilities into one device on the Alexa side. You can go over the skill concept documentation to get more information.

1 Like

Thank you for the advice. Of course I have the device names in German, I thought it might be beneficial to use English example names to get more people to better understand my question.

One further question: From what documentation page do I/you pull the alexa="Endpoint.InteriorBlind"? I can’t find information on that anywhere.

What I was trying to say is, that the range controller alone works for me, however the group endpoint tigether with the range controller does not.

Thank you for your continued help.

I figured :+1: I was trying to make sure especially with all my explanation related to localization.

You should check the group endpoint documentation. Basically, in that example, the group endpoint will be defined as display category “INTERIOR_BLIND”. There is a small addition I need to add to the documentation in the fact that you can use camel-cased category names when they include an underscore. You could have defined that group endpoint as alexa="Endpoint.INTERIOR_BLIND" but I personally don’t think it is that clean :smile:

I see. This is strange. But a lot of the concept I mentioned above is fairly new and some such the latest display categories that were added recently may not be supported in other languages as of yet, it could be just a naming issue, or even how the request is formulated. Anyway, as you might have noticed, some of the advanced configuration is just trial and error.

1 Like

Oh well, according to the list of supported locales, the range controller should be working right now.

I could not find, however, how to correctly adress the rangeController in German.

I mainly tried (with friendlyNames="Öffnung" for the Rollershutter and a preset of presets="100=@Value.Open")
“Alexa, setzte Öffnung von Jalousie auf 100!”,
“Alexa, setzte Öffnung von Jalousie auf ‘offen’”
and
“Alexa, setze Jalousie auf 100”, to which she replied “Which setting?”, so I told her “Öffnung”, but then she replies “Ich weiß nicht, wie ich diese Einstellung für Jalousie machen kann”. My translation: “I don’t know how to apply this setting for ‘Jalousie’”.

Correct but it’s not in the skill yet. Currently, all text labels are hard coded to “en-US” locale in the skill. Basically preventing the support for other languages unless using an asset id. Unfortunately, you will have to wait for the enhancement I mentioned above to be released to the live skill.

Once the change will be in place, the default text label language will go by your OH server regional settings or you will be able to define it in the metadata parameters (e.g. friendlyNames="Öffnung@de-DE")

Great. I’m quite new to openhab and smart home tech in general, so I’m often not used to the vocabulary and didn’t make enough of a distinction between the skill and the amazon api. Thank you for clarification.