How can I make Alexa detect a sensor status and carry out an action based on it? (Garage Door use case)

So I’m looking to do something fairly basic, I think. I have a SmartThings multipurpose sensor on my garage door, and an LFM-20 Z-wave switch attached to the door opener. The switch is in virtual momentary pushbutton mode.

Today, I can say “Alexa, turn on the Garage Door opener” and it will momentary press and the door will move to the opposite of the position it’s in (open/closed)

What I’m looking to do is to be able to say “Alexa, close the garage door” and get a response of either “the door is already closed” (based on the multipurpose sensor’s position) or “ok, closing the door” (the latter followed by an action) - and of course, the inverse of this where I tell her to open the door and she detects if it’s open or closed and responds accordingly.

Has anyone seen an integration like this?

Tagging @MichaelS

Thanks @JDRoberts!

@jawn101 Ask Alexa already does something like this with the integration garage door opener(like the Linear model). However when you do it with different devices I am not 100% sure it will work. I recommend trying my app and if it doesn’t work I can work with you to integrate it.

Aha! I do have the Ask Alexa integration set up but I haven’t really used it for much, and am not entirely sure how to connect the dots here within it. Open to suggestions!

The actual Ask Alexa app or the native integration with SmartThings?

Oh, I didn’t know there was an app other than the SmartApp I loaded into SmartThings.

This is what I have

28 PM

That is the one! Did you ever get it running or just installed it?

It’s installed and works as far as I can tell - I can ask it the status of sensors and it appears to be providing responses. Though TBH I’m not sure if those responses are coming from your app or SmartThings natively :slight_smile:

Status is not supported by the native integration so if you are saying “Alexa, ask Smartthing about the Living Room” (Or something like that) then it is working.

I would then go into the doors area and see if you can control the garage door.

OK, great! As a test I just asked Alexa “ask SmartThings about the office window” and she responded that it was open. So that means your app is functional?

So, again - forgive the noob questions. “Go into the doors area” - not sure how to do this. I can control the door via the SmartThings app natively, as I said (alexa, tell smartthings to turn on the garage door) but that’s not routed through your app I don’t think.

2 Likes

Yep…Very good…you have Ask Alexa working!

As for the question, there is a main menu item called “Doors/Windows/Locks” where you can add the sensors for your doors…If you start anything with “Alexa, Ask Smartthings…” it is going through Ask Alexa. So, that is working?

1 Like

Yep, same configuration for the door as a window: “Ask SmartThings about the Garage door” = “The garage door is currently closed”

So I guess I am unclear on your question as you can also control the door through the app as well.

What I’m looking to do is make a more natural language, state-aware integration. So instead of a two-stage “ask about the garage door” followed with “turn on garage door”, I’d like to actually say “close the garage door” and have Alexa check the state and respond accordingly.

That is currently what it does with a single device. For example, I have a Linear Garage Door opener that is both a control mechanism and a tilt sensor…If I ask Alexa to close the door and it is already closed it will respond back that it is already closed. The issue you are looking to solve is to tie the two control mechanisms together…right now SmartThings sees those two devices as separate…correct?

I could add a method that you could define a momentary switch and sensor as one device and control it…Quite honestly I thought there was already a DTH that did it and presented the two devices together as one…This would then allow apps to control them using the default method. Or you could purchase a Linear Garage Door opener :slight_smile:

Let me know if that sounds about right…

Yes, thats exactly right! They are two separate devices, as I retrofitted my existing door opener with a z-wave switch and a sensor, rather than replacing the whole unit. So the goal would be to combine them for the purposes of this integration.

Have you looked for a custom DTH that ties the two devices together as a single device. Selfishly, that would keep me from coding this in, but holistically, it is a more ‘supported’ way of doing it. I can certainly add something like this to Ask Alexa in the next version, but it is really a hack and I am almost positive a single DTH exists that combines two devices into a single unit.

@JDRoberts do you recall what I am referring to? Or am I hallucinating again :slight_smile:

The end goal is for a single ‘device’ to appear to Ask Alexa (and all other SmartThings apps) as a combined device like the linear garage door opener. @jawn101 If this does what you need it to, we are done and it should work in all standard apps…if you can’t get this to work let me know as this would indicate there is no other way to do this and a solution in Ask Alexa would be a good investment as I am sure you are not the only one with this setup. However, I REALLY recommend the Linear setup…it is clean, simple and has never once failed me. It also complies with 2017 standards of sounding an alarm if the door is about to make a movement on its own…something a simple relay and level sensor probably doesn’t give you.

1 Like

I have a Ecolink Tilt Sensor and a Remotec Zwave Relay to operate my garage door.

I use a modified simulated Garage Door DTH for the tilt sensor. I started with this below and modified it for appearance.

I then used this smart app to link the relay button to the tilt sensor that has the Simulated Garage Door DTH.

Then to make sure the relay turns back off I use webCoRE to turn it off 1 second after it turns on.

1 Like

Yeah, that’s the end goal here. I’m not aware of the Linear setup you speak of, but I know there are some limitations to how I’ve rigged it up. The door does have an electric eye that stops it moving if there are objects in the way, so I felt safe doing it the way I did.

I’m looking at that DTH whicih JDRoberts posted above but it appears the git repo is dead, I tried to add it and nothing pulls.