[How To] Alexa V3 - Report status of window contact (Update: now possible via ContactSensor in DE)

Tags: #<Tag:0x00007f616fc28c60> #<Tag:0x00007f616fc28a80> #<Tag:0x00007f616fc288a0>

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. :crazy_face:
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! :smiley:
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.
:stuck_out_tongue: 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.

4 Likes

Short addon: This also works without the “.detectionState”.