Hello,
As it is sometimes - you wait months for something until you create a workaround and a week later Alexa detects my “ContactSensor” item in a search for new devices.
Even though it’s not updated in the “Openhab Alexa V3 skill” documentation - not even in the Alexa skill API documentation from Amazon - that ContactSensor is supported in Germany - it can be found by Alexa App and shows the status ‘open’ vs. ‘closed’. Alexa also responds to the question: “Is my bedroom window open?” with “Bedroom window is closed” (without the phrase “I’ll check this”)
The additional “Switch” items are not necessary anymore. Just add alexa=“ContactSensor.detectionState” to your “Contact” item. For groups of windows I created an additional “Contact” item which references the group, instead of adding the Alexa tag in every window contact.
My new items file looks like this:
// group for complete MAX! system
Group gMax "Max! system"
// groups for rooms
Group gMaxBedroom "Bedroom" (gMax)
// groups for specific aspects
Group:Contact:OR(OPEN,CLOSED) gMaxWindow "Windows contacts" <window> (gMax)
// house
Contact house_windowContact_stateControl "Windows in my house" {alexa="ContactSensor.detectionState" [itemSensor="gMaxWindow"]}
// bedroom
Contact og_bedroom_windowContact_state "Bedroom window" <window> (gMaxbedroom, gMaxWindow) {channel="mqtt:topic:myMQTTBroker:og_bedroom_windowContact:STATE", alexa="ContactSensor.detectionState"}
— old post —
since the current Alexa Skill API doesn’t support category “ContactSensor” in Germany I was wondering if I could request the state of my MAX! window contacts in another way.
Therefor I found category “LockController” for which Alexa is able to tell the status locked (“abgeschlossen”) and open (“geöffnet”). So I updated my item definition of the window contacts with this category and guess what: It’s working perfectly!
If I ask Alexa for example: “Is my bedroom window closed?”, she’s answering me: “I’ll check this.” and later “Bedroom window is closed”. You can also ask “Is the bedroom window opened?” or “What’s the status of my bedroom window?”.
I used this solution for all of my window contacts and have now also the possibility to ask Alexa if any window in my house is closed or opened. Makes it easy to know if any window in the attic is open when it begins raining, without looking into the App or walking up the stairs.
Kind regards,
Carsten
My items file:
// group for complete MAX! system
Group gMax "Max! system"
// groups for rooms
Group gMaxBedroom "Bedroom" (gMax)
// groups for specific aspects
Group:Contact:OR(OPEN,CLOSED) gMaxWindow "Windows contacts [MAP(max.map):%s]" <window> (gMax)
// house
Switch house_windowContact_stateControl "Windows in my house" {alexa="LockController.lockState" [itemSensor="gMaxWindow"]}
// bedroom
Switch og_bedroom_windowContact_stateControl "bedroom window" {alexa="LockController.lockState" [itemSensor="og_bedroom_windowContact_state"]}
Contact og_bedroom_windowContact_state "Bedroom window state [MAP(max.map):%s]" <window> (gMaxbedroom, gMaxWindow) {channel="mqtt:topic:myMQTTBroker:og_bedroom_windowContact:STATE"}
Hint: After searching for new devices in Alexa, the window contact (aka window lock) item in the Alexa App sometimes seems to be unresponsive. In this case you can simply open and close the corresponding window one time and the status will be updated.
i try to add an Homematic IP Windows Sensor to ALexa. My problem now is that the Homematic Thing/Itemn is a String-Item an dAlexa tells me “Device is not responding”.
I tried to change the String to Contact with the same result.
The ContactSensor interface only supports Contact or Switch item type. So if the Homematic binding doesn’t support such item type for providing a contact state, then you will have to use a proxy item.
In order to better understand your setup, can you please provide the item definition you are trying to expose to Alexa?
With a rule I tried to convert the String to Contact:
//Flur Tür
rule "Tür String to Contact"
when
Item TuerKontakt received update
then
if (TuerKontakt.state.toString.contains("OPEN")){
TuerFlur.postUpdate(OPEN)
sendTelegram("achterhome", "Tür offen")
}
else {
TuerFlur.postUpdate(CLOSED)
sendTelegram("achterhome", "Tür geschlossen")
}
end
I noticed that the String item is not logged when my door opens. I think that is the problem. I tried the Sensor direct or via a Heating-Group. Both are not showing up in my logs files exept I reboot my Raspberry. Than the sensor get a state once.
Your item definition looks good to me, from the Alexa configuration perspective. I am not quite sure if you are saying you are still having an issue or you got it working. Anyway, if there is some kind of updating issue, then it would think it’s on the homematic side at this point.
I still have the problem with my door sensor. But at this point I think too it is a problem with Homematic. I try to reconnect the sensor this evening and report back if it is working.
Is it possible to get the state of a switch item? I know, that alexa=“ContactSensor.detectionState” is also usable for switch items. But then I have to ask alexa “Alexa, is the Light open?”. Alexa doesnt understand the question “Alexa, is the Light on?”
Is it possible to set a “friendly name” e.g “window” to all contacts?
I have various contacts (skylight, Balcony, …) and I would like to ask:
Alexa, which window is open?
Alexa just mentions the Windows with “window” in their name (item label).
This is unfortunately not possible. You have to request each specific device. However you could create a group contact item type that includes all your window contact sensors and represents the overall state of these sensors that you could request via Alexa. It’s not exactly what you wanted but at least you will know if all your windows are open or closed.
In my case if the switch is on, the window is closed and off, if it is open.
With the setup above alexa tells me, the door is open, although it is closed.
It seems a “ON” switch is interpreted as an open window.
Is there a possibility to invert the state, so that alexa recognizes the window state correctly?
I have two windows in my bedroom and both have contact sensors and I have them in Alexa now aswell.
What would currently be the best solution if I want to be able to ask Alexa something like:
Sind die Schlafzimmer Fenster geschlossen? and then get an answer back if one of the windows is open (lets say the left one) which is something like: Schlafzimmer Fenster Links ist offen.
You can only request if a given contact sensor is open or not. You could however have a group representing multiple contact sensors but you would only be able to know the state of that group.
Unfortunately we have no control at the skill level to implement what you are asking.
Nope. Again, we have no control at the skill level. Proactive reporting will only allow contact sensors to be used in Alexa routines as trigger devices.