Official Alexa Smart Home Skill for openHAB 2

Oh I see a mistake in the item name

Why are you trying to send the command to the group item? Now I understand the looping issue here. The only purpose for it is to model a single endpoint in Alexa for the two components. Your rule should point directly to the items that are controlling your blinds.

See above :stuck_out_tongue:

The rule now runs without error but blind does not stop.

rule "Office blind command"
when 
    Item OfficeBlindCommand received command STOP or
    Item OfficeBlindCommand received command UP or
    Item OfficeBlindCommand received command DOWN
then
    Office_RollerShutter.sendCommand(receivedCommand)
    logInfo("TEST" , 'rule ran . rC = '+ receivedCommand)
end

However, replacing sendCommand(receivedCommand) with sendCommand(STOP) and it works

For both STOP and received Command I see this in the log

[INFO ] [.eclipse.smarthome.model.script.TEST] - rule ran . rC = STOP

fixed it with this change…

receivedCommand.toString

Log shows this for ’ Alexa, Set Office test to UP,DOWN,STOP and the blinds behave accordingly

[INFO ] [.eclipse.smarthome.model.script.TEST] - rule ran . rC = UP

[INFO ] [.eclipse.smarthome.model.script.TEST] - rule ran . rC = DOWN

[INFO ] [.eclipse.smarthome.model.script.TEST] - rule ran . rC = STOP

So, Its all working now. Thank you.

Final rule…

when 
    Item OfficeBlindCommand received command STOP or
    Item OfficeBlindCommand received command UP or
    Item OfficeBlindCommand received command DOWN
then
    Office_RollerShutter.sendCommand(receivedCommand.toString)
end
1 Like

Nice! :+1:

Well, amazon logs say my voice commands were understood as I wanted them to be understood.

This is part of the event log:

2019-12-21 21:10:01.364 [ome.event.ItemCommandEvent] - Item 'RS1 ' received command 41
2019-12-21 21:10:01.432 [nt.ItemStatePredictedEvent] - RS1 predicted to become 41
2019-12-21 21:10:01.465 [vent.ItemStateChangedEvent] - RS1 changed from 31 to 41
2019-12-21 21:10:03.103 [vent.ItemStateChangedEvent] - RS1 changed from 41 to 37

I don’t really understand why there is the second ChangeEvent. It seems like this is related to the moving back due to correcting the slats’ tilt. However, the amount is inconsistent between different runs.

Ultimately, I think this is not a problem of the Alexa Smart home skill anymore, but a problem of changing some motor parameters for my blinds. It might take a while to get this sorted out, and I will report back once this is done.

In the meantime, I have one more question: Can you provide an example how to adress the rollershutter, if it is included inside a group endpoint, in German? I could not find the correct utterances anywhere, and I just can’t adress the items if defines like this:

Group gOne "Ente" {alexa="INTERIOR_BLIND"}

Rollershutter RS1 "Avocado" <rollershutter> (gOne) { channel="zwave:device:babe135b:node3:blinds_control", alexa="RangeController.rangeValue" [supportedRange="0:100:1", presets="0=@Value.Close,100=@Value.Open,20=blau", unitOfMeasure="Percent", actionMappings="Close=0,Open=100,Lower=(-10),Raise=(+10)", stateMappings="Closed=0,Open=1:100"]} 
Dimmer RS1_Tilt "Ananas"  <slats>  (gOne) { channel="zwave:device:babe135b:node3:blinds_control2", alexa="RangeController.rangeValue" [ supportedRange="0:100:1", presets="0=@Value.Open,65=rot,100=@Value.Close"]}

If I utter “Alexa, setze Ente auf blau”, then Alexa asks “Welche Einstellung?”, I respond “Avocado!” and nothing happens.

The first change is related to the command received by the skill and the second one is the actual change that your binding applied. As you mentioned this is not related to the skill.

Since you didn’t specify the friendlyNames parameter on either items part of the group, it will default to the item label. So to address the component separately, you have to use that label (e.g. “Alexa, setze Ente Avocado auf blau” or “Alexa, setze Ente Ananas auf rot”). Also, keep in mind, that each semantic extension can only be specified once in a group endpoint. However, you can mix for example lower/raise for the opening and open/close for the tilting, or vice-versa, but no overlapping (include state mappings as well) is allowed. The Alexa discovery will silently fail in that case.

This is odd. It should have worked as long as the preset name is unique across the items of a group endpoint. I just tested your item definition on the Alexa simulator and it’s working fine. Maybe, the Alexa language processing didn’t understand your device name. You should always check your Alexa voice transcript history to see what was understood.

Can I replace

Switch NorthPIRLights_Switch "Outside test" <light>  ["Lighting"] {channel="openwebnet:bus_on_off_switch:Screen10:22:switch"}

with

Switch NorthPIRLights_Switch "Outside test" <light> {alexa="ToggleController.toggleState" [category="LIGHT", friendlyNames="Switch"], channel="openwebnet:bus_on_off_switch:Screen10:22:switch"}

?

I want to create a Group with a mode controller and a toggle controller but the toggle controller part isn’t working for me. I get ‘…doesn’t support that’ when asking saying 'Outside Test OFF, or ON

You have to use the friendly name you defined, otherwise modeled your item as PowerController if you only have one switch in your group. “Alexa, turn on outside test switch” or “Alexa, outside test switch off”.

I think Amazon implemented this on purpose so you can mix PowerController and ToggleController for specific device ON/OFF settings. So the main turn on/off request would be controlling the power and when using the component name, it would control the toggle items.

I am struggling to get a feel for this stuff at the moment and got a curious response with this item definition

Used as a single item

Switch NorthPIRLights_Switch "Outside test" <light> {alexa="ToggleController.toggleState" [category="LIGHT", friendlyNames="Outside test"], channel="openwebnet:bus_on_off_switch:Screen10:22:switch"}

Which produces this:
image

As you suggested power controller works both as a standalone item and in a group endpoint

Switch NorthPIRLights_Switch "Outside test" <light> {alexa="PowerController.powerState" [category="LIGHT", friendlyNames="Outside test"], channel="openwebnet:bus_on_off_switch:Screen10:22:switch"}

Thanks again Jeremy… Now my idea is working…

Explanation of my goal for others who might want to do something similiar….

I have PIR activated lights with an override function which when activated switches them to constant On for 4 hours. The PIR override is activated by a rapid sequence of OFF/ON/OFF/ON.

Normally I switch them ON and OFF using a Sitemap switch and for the override I press another Sitemap switch which then causes a rule to run the override sequence.

For Alexa I wanted to do it like this:
‘Alexa, turn outside light ON’ or
‘Alexa, turn outside light OFF’ or
‘Alexa set outside light to CONSTANT’

This was achieved with this code:

Item file:

Group OutsideNorthLights "Test" {alexa="Endpoint.LIGHT"}
    String OutsideNorthLights_Command "Outside north light command" (OutsideNorthLights) {alexa="ModeController.mode" [supportedModes="ON=ON,OFF=OFF,CONSTANT=CONSTANT", autoupdate="false"]}
    Switch NorthPIRLights_Switch "Outside test" <light> (OutsideNorthLights) {alexa="PowerController.powerState" [category="LIGHT", friendlyNames="Outside test"], channel="openwebnet:bus_on_off_switch:Screen10:22:switch"}

Rule:

rule "Outside north light command"
when 
    Item OutsideNorthLights_Command received command 'CONSTANT'
then
    NorthPIRLights4hrs.postUpdate('PRESSED_EXT')
    logInfo("test" , 'Outside north light command received = '+ receivedCommand)
end

Hi,
I am trying to use new metadata declaration for items but I cannot make [french] Alexa understand “Open” and “Close” for blinds. Meanwhile command “Set to x%” is understood correctly.
My OpenHAB locale settings seem to be correct. My item declaration is:

Rollershutter AX_DW_mRDC_Salon_volettest "Test" {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"]}

Rollershutter AX_DW_mRDC_Salon_voletproto "prototype" {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"]}

Any suggestion on what I am missing?

That’s odd. Using the translated “open/close” terms in French “ouvre/ferme”, it’s able to identify the device but rejects the command. However, “raise/lower” translated to “monte/baisse” works. It might be a bug on the Alexa side or other terms are expected for these actions.

Try to set the friendlyNames to the following

friendlyNames="@DeviceName.Shade"

I’m loving how this type of integration is becoming more natural.

@m4rk, your trigger is CONSTANT but without quotes. Is it a, cough, constant defined somewhere or is it supported like that?

I tested the rule and it seems to trigger with and without quotes. It looks better with quotes :slightly_smiling_face:.

I also added Expire command to reset the string after its been updated. It not necessary but helps when checking if the string was actually updated in Sitemap.

String OutsideNorthLights_Command "Outside north light command" (OutsideNorthLights) {alexa="ModeController.mode" [supportedModes="ON=ON,OFF=OFF,CONSTANT=CONSTANT", autoupdate="false"], expire="4h,command=NORMAL"}

Changed the friendly name to

friendlyNames="@DeviceName.Shade"

And it still behaves the same [for french]: accepting “raise/lower” but rejecting “open/close” :thinking:

really strange. In Italian open/close/raise/lower work if I identify the rollershutter with the exact label, like “alexa, open the bedroom rollershutter”. But if I want to leverage room awareness, saying “alexa, open the rollershutter” when I’m in the same room of the echodot, only raise/lower work fine, open/close don’t work. :open_mouth:

I opened a case with the Alexa developer support team. Let’s see what they come back with.

Seems the ON and OFF commands in german won‘t work as well.

Assuming you are referring to your original post below, I have responded to it.

@wawa79 So while answering a similar question for the Spanish language, I was able to get it working for the French language as well. It appears that you have to formulate the request a certain way.

If you label your item as Salon Volet, the below utterances are working.

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

“Alexa, ouvre le volet du salon”
“Alexa, ferme le volet du salon”