Programmatically Close Simulated Contact Sensor?

Is there a way to programmatically close a Simulated Contact Sensor? e.g. via a Routine.

I want the contact sensor to close whenever a Simulated Switch is turned off.


Super easy: you just have to use a DTH for the contact sensor which also includes capability.switch. That way when the switch is turned on, the contact sensor is open. When the switch is turned off, the contact sensor is closed. :sunglasses: See the FAQ on the new echo routines: it uses that kind of device.

I know I am getting lazy and you know that I know how to cook this up but I am actually a little confused here…

Are you suggesting that there is a way to directly tie this in without the use of an app like webCoRE or SmartLighting? I see how adding the capability.switch in a simulated contact will allow it to be controlled locally via SmartLighting but would’t that be a custom DTH that forces it to the cloud?

I am super curious here.

Thanks as always @JDRoberts

Yeah, it’s not going to run local, but I don’t see anything in the first post that says local. Did I miss it? Because it mentions routines, and those don’t run locally either.

No, I was just thinking out loud and had an ah-ha moment. Was seeing if it was a way to mirror open/close with switches locally for my own stuff. :thinking:

Also still curious if its a way to directly associate this without the need of an app. I believe you inadvertently taught me how to do this with physical switches using a minimote.

1 Like

“Z wave direct association“ is limited to physical Z wave devices, you can’t use virtual devices because the message is sent directly from one device to another without going through the hub.

1 Like

Dang, I though you were going to make my day! :disappointed_relieved:

@ucdscott, I use webCoRE and setup a rule like such:

If simulated switch changes to on
Then with simulated contact

If simulated switch changes to off
Then with simulated contact

You can use webCoRE to cook up whatever rule you like to open/close the simulated contact.

Changing to a DTH with capability.switch as @JDRoberts stated, you should be able to mirror the simulated switch with the simulated contact because SmartLighting would see it as a switch. Smart @JDRoberts!

1 Like

Is this functionality working in the “new” ST? or only classic? I’ve been going round in circles trying to get the simulated contact sensor to open/close - it shows online in IDE and now that I have moved through Virtual Switches and back to Simulated Contact Sensor it shows online in ST App on my phone - but cannot figure out how to link it to a switch or routine.

Is there a custom DTH that you could share? I’m using the stock one in the drop-down list. There does not appear to be a Virtual Contact Sensor (and unfortunately I am running a Samsung Wifi with Plume - ET-WV525 Hub - so currently the Edge Drivers aren’t supported)

The functionality works fine, but you have to use a virtual device which is BOTH a sensor and a switch. That way when you turn on the switch, the sensor looks like it opened. When you turn off the switch, the sensor looks like it closed. this is discussed in detail in the community FAQ linked above. :sunglasses:

There are links in that FAQ to both a groovy DTH like this or one of the new edge drivers which is still in beta. So you can use either as you prefer.

FAQ: Can I trigger an Echo Action without Speaking to It?

as you noted, you can’t use just a sensor, because you won’t have any way to turn it on and off. And you can’t use just a switch, because as of this writing, Alexa routines cannot be triggered from those. But fortunately, smartthings does allow us to create a virtual device with both capabilities, and then you’re all set.

The Simulated Contact Sensor is very much a legacy device. It uses ‘custom commands’ to do the open and close and legacy apps could be written to exploit those. Modern apps stick to the capability model and so would require a ‘custom capability’ to do the same thing. However a more popular solution is to combine the Contact Sensor capability with a Switch capability and use that to give the active/inactive switching. So turning the switch on opens the contact sensor, and turning it off closes it. It ties in nicely with Alexa.

1 Like

Does anyone have a custom DTH that they are willing to share that combines the switch and contact sensor capabilities? Much appreciated

The one most people use is linked to in the FAQ on this process that was linked to up thread. There are some other details in that FAQ that might also be helpful during this process. Here’s the link to the FAQ again.

FAQ: Can I trigger an Echo Action without Speaking to It?

(We do have some community members who have difficulty following links for one reason or another, so if that applies to you, just let us know, and we can give you posts with direct links. Otherwise, the FAQs will usually have whatever you need, that’s why they’re there. :sunglasses:. )


Also, if you are using an android phone, you can go into “labs” in the smartthings app and in the US and the UK there will be an option there to create a virtual switch for Alexa. But it’s not available in the iPhone version.


Here’s the link for the Groovy DTH. (The topic title is the clickable link.)

Or if you like, there’s an edge driver you can use.

1 Like

Many Thanks @JDRoberts!!! I have added that DTH and its awesome, Greatly appreciate your assistance.

1 Like