I got alexa into my openHAB and all the documented functions seem to work. However, I got contacts for my windows and would like to ask alexa for the state of all windows. Basicly Id like to ask if all windows are closed.
Is this even possible? It seems “contact” is not a supported tag. Any ideas? Are there any workarounds? Could I maybe fake the summarized state of all windows into an item like a switch and then ask for that items state or something?
I don’t really know Alexa since I don’t have one, but I don’t think that you can do that directly from openHab. Maybe you can make an OR Group and expose it to the cloud. You can ask if this switch is ON or OFF… Or you can use IFTT and then you can send string based on the item state (“All windows are closed”) or something like that
All you need is a Temperature item. Give it any name you want. I have one called “Outside”. Then I ask Alexa for the “Outside Temperature” and she responds. But this temperature can represent anything. So you could have a garage door and you set it to 100 for open and 0 for closed. Then ask Alexa what the “Garage Door Temperature” is and she will respond as 0 or 100.
Hopefully this will get easier once the V3 Alexa skill is developed.
Hello,
I’ve written a rule that loops over all windows and if any of them is open, the label of the device is added to a string.
At the end of the rule, the string is spoken via echo tts.
This is the rule to loop over all windows, which in my case are all member of the group gContacts.
openwindows is a counter which is incremented when an open contact is discovered.
Talk_OpenWindows is a switch item that may be triggered by any event to initiate the status report via Echo device.
rule “Talk_OpenWindows”
when
Item Talk_OpenWindows received update
then
var String textZeile1= “”
var openwindows = 0
gContacts?.members.forEach ( item |
if (item.state==OPEN) {
textZeile1 = textZeile1 + item.label +" , "
openwindows=openwindows+1
}
)
if (openwindows == 0) {
Echo_TTS.sendCommand("All windows are closed.")
} else {
Echo_TTS.sendCommand(textZeile1)
}
FYI, the Alexa V3 skill gives the ability to model a contact sensor and request its state by voice. However, it cannot be used in Alexa routines as of yet.
Alexa, lock the door Alexa, is the door locked? Alexa, is the door open?
Update
Actually, you are better off modeling each capabilities as single endpoint and create a group “Door” on the Alexa side that include these two, as you wouldn’t be able to setup the unlock pin in the Alexa app, when part of the group endpoint.