Garage Door Control after v2?

Well I think the issue most are talking about is that previously you could link the multi to the relay. That would give your multi a custom devicetype of “SmartSense Garage Door Sensor Button”. Said Sensor Button would get the status from the multi but have an interactive icon controlling the relay. Thus you’d have a single thing that could both tell you the status and let you change it. That was further enhanced by allowing the Doors and Locks legacy SmartApp to see devices with this device type as a Door and thus display it in that dashboard. Further I’m pretty sure it was this devicetype that provided the open/close capabilities and allowed things like SharpTools to send distinct open/close commands versus a state-unaware toggle.


Okay guys… I upgraded to Hub 2.0 a couple of days ago. I think this should work as a solution… it’s a very simplistic SmartApp, but it should work… at least it does for me.

You need to change the Multi-Sensor to SmartSense Garage Door Sensor Button in the IDE, then install the following program. Just input the sensor and the associated relay/switch and then tapping the SmartSense Garage Door Sensor Button will trigger the relay or switch.

(If you’re using a switch/outlet – like me – you’ll want to setup an automation in Smart Lights that turns off the outlet as soon as it’s turned on so it’s ready to be trigger the next time you need it.)

 *  Virtual Garage Triggers Outlet
 *  Author: chrisb

// Automatically generated. Make future change here.
    name: "Virtual Garage triggers outlet",
    namespace: "sirhcb",
    author: "ChrisB",
    description: "Tapping a SmartSense Virtual Garage Sensor Button triggers and outlet connected to a relay to open/close a garage door, and then shuts off the outlet after 4 seconds.",
    category: "My Apps",
    iconUrl: "",
    iconX2Url: "",
    iconX3Url: "",
    oauth: true)

preferences {
	section("When a Virtual Garage Door is tapped..."){
		input "GarageSensor1", "capability.contactSensor", title: "Which?"
	section("Trigger which outlet?"){
		input "switches", "capability.switch"

def installed()
	subscribe(GarageSensor1, "buttonpress.true", contactOpenHandler)

def updated()
	subscribe(GarageSensor1, "buttonpress.true", contactOpenHandler)

def contactOpenHandler(evt) {
	log.debug "$evt.value: $evt, $settings"
	log.trace "Turning on switches: $switches"

That worked, thank you!

I received the exact same response word for word from support. It seems they’ve automated their support by taking away our previous automation abilities.

Here’s a z-wave version of the SmartSense Garage Door Sensor Button this should be compatible with any device supported by the Z-Wave Door/Window Sensor.

Combined with the code @chrisb posted above to intercept the events emitted by this device and a Z-Wave Relay set to the Z-Wave Virtual Momentary Contact Switch device type you should have a working garage door for use in routines.


Amazing! It works! Thank you!

How do I add this code to my smartthings? I also have a z-wave evolve relay on my garage door opener and a smartthings multisense. Sorry, noob here.

Any idea what would be keeping the relay from toggling the garage door? I had to shave the wires down some to fit them into the holes where the push button wires lead to, but I wouldn’t think that would be the issue.

the power end is correct and the hub found it with no issues. I changed it to a z wave virtual momentary contact switch. It triggers and I can hear the relay click, but I don’t believe it’s sending power since the door wont open.

The relay does not send power. It essentially shorts the two wires together. If you take just a chunk of wire and touch it to both sides does the door open? Newer doors will not work this way. They have smart switches that send a data command instead of just shorting the two sides. If your garage door button looks like a doorbell your good. If it looks more complicated has multiple buttons or a “learn” button then your system is newer and more complicated.
My garage door opener is new so I opened the wall button and soldered to the button contacts and attached the relay to that. Or you can buy a more advanced option vs a relay.

Hope this helps a bit.

You can also post a picture of your garage door button and someone can give you an idea if yours is data based or not

@jdetmold It’s just the doorbell type with two wires that lead to the opener into their holes. Chamberlain Model HD220

I also just went back and restripped the relay wires so they wouldn’t be shaved down. Added a wire nut and used left over wire from the power plug I spliced to use that for the holes. Still nothing but a click from the relay.

I’ve had this working in the past with a diff model opener using ninja blocks and an arduino relay. I’m fairly positive I’m setting it up correctly. I mean it’s just two holes to put the blue wires in. I assume the relay is good since I’m hearing the click when I push the button on the app

Can someone please explain how to do these steps?

Try the other teminals on the garage door box. Only 1 set works, the others are for door beams etc.

I can try. I’m not sure how far you’ve gotten so here’s all the steps. Let me know what you’ve done and what you might need further help with:

Over all you have three main steps that need to be done:

  1. Hardware physical setup
  2. Installation of my code as a custom SmartApp
  3. Install and configuration of the SmartApp.

I. Hardware:
1a. Relay: You need to have a relay setup to trigger the opener to open/close. There are a number of different options out there, some of which at as momentary buttons, some of which act as on/off buttons. Which type you have will be important later.

1b. Sensor: You need an open close sensor on your garage door. I use a SmartSense from SmartThings… I’m not 100% sure if my app will work with other open/close sensors.

1c. In the SmartThings IDE you need to change the device type of your open/close sensor to “SmartSense Garage Door Sensor Button.”

II. SmartApp Code
2a. Get the code from earlier in this thread, copy it and have it handy.

2b. In the SmartThings IDE go to the SmartApp section and click new smartapp button. Select the ‘From Code’ tab and then paste in the code you copied above.

2c. Save it, then publish it for you.

III. Installation and configuring of SmartApp
3a. Now in the mobile app on your phone, tap the “star” in the lower right corner to add new stuff. Select the “SmartApps” tab and scroll to the bottom and tap the My Apps section.

3b. Find the app called Virtual Garage triggers outlet (assuming you didn’t change the name when you added it in step 2b). Tap on it to start the install process.

3c. The App will ask for just two things: First you need to indicate which open/close sensor you’re using. Second you need to indicate which outlet/relay you’re using. Give the app a name then tap DONE to install it.

3d. Now we need to go back to 1a. IF you’re relay device acts as an on/off device we need to do one more step. An on/off device will stay on until you turn it back off. For a garage door opener relay this is not good. If the outlet/relay stays on then we can’t trigger the door again until it’s off. So…

3d1: Start a new SmartLighting automation.
3d2: Say that we want to turn off a switch/outlet – obviously the thing we want to turn off is our outlet/relay.
3d3: The trigger for when to run this automation is when something turns on. The “something” is also our outlet/relay.
3d4. Save this new automation.

Now whenever this outlet/relay is turned on ST will automatically turn it back off.

Okay, so there’s the steps. Like I said, let me know which you’ve done and which you need any extra help/detail with.


@leblaaanc can you clarify what you mean by combining the code with @chrisb code? Is the complete code posted somewhere? When we paste your code into the SmartThings IDE it gives an error message.

No signature of method: script14504027825591658013443.metadata() is applicable for argument types: (script14504027825591658013443$_run_closure1) values: [script14504027825591658013443$_run_closure1@ 34b2a11c] Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure)


I dunno about that error. To clarify you need @chrisb’s SmartApp to map the contact sensor’s virtual button to the relay. The contact sensor virtual button is added by my custom device type (or the smartsense one in the context of that device).


It’s a two part process here. Forgive me if I’m talking down to you a bit… not sure how much you know about this or not so I might be giving very simple information. However, even if it’s something you know already it might help someone else.

SmartThings, many months ago, created a DeviceType for this SmartSense Multi-Sensor that includes a virtual button. The DeviceType is a bit of software that tells the hub how to communicate with the hardware devices. (Think ‘printer driver’ if you familiar with that concept.)

I wrote a bit of software, a SmartApp, that looks for that virtual button to be pressed. When it is, it tells the hub to turn on the relay/outlet that is controlling the garage door, there by opening or close it.

What’s the benefit? Well, now in the mobile app you have what appears to be an all in one device. You can see if your garage door is open or closed AND by tapping it you can open or close it. It’s not a HUGE deal, but it makes things a little cleaner and easier in the mobile app. (Actually, in the older version of the Mobile App this was an even bigger deal as the layout was a bit different.)

So, where does @leblaaanc come in? Well, the DeviceType was created by SmartThings for this device, which is a Zigbee device. Their DeviceType may or may not work with other Zigbee tilt or open/close devices but it surely won’t work with any z-wave device. LeBlanc’s DeviceType will work with z-wave devices.

So when he said “combine” he doesn’t mean to put the two pieces of software together, but rather you need to create the new z-wave DeviceType and combine that device with my custom app from above.

Here’s the quick list of steps. Let me know if you need more detail on how to do any of this:

  1. Copy LeBlanc’s DeviceType code from above.
  2. In the SmartThings IDE, go to ‘My Device Types’ then click on ‘New Device Type’, then click the ‘From Code’ tab. Paste in LeBlanc’s code, save it and publish it.
  3. In the SmartThings IDE, go to ‘My Devices’ then find the z-wave sensor that you want to use, click on the name, then scroll to the bottom and click the ‘edit’ button. In the ‘TYPE’ field, scroll down to the bottom of the list to find your personal DeviceTypes. Select the one you just created in step 2. Click ‘Update’ to save your changes.
  4. Copy my SmartApp code from above.
  5. In the SmartThings IDE, go to ‘My Smart Apps’ and then click on ‘New Smart App’, then click on the ‘From Code’ tab. Paste in my code, save it and publish it.
  6. Finally, in the MobileApp on your phone/tablet, tab the Star in the lower right side then the ‘SmartApps’ tab near the top right. Scroll down to the bottom and in the My Apps section find the app you just created in step 5. Tap on it to start installing and pick the appropriate devices.

That should do it!


Thank you so for the clarification @chrisb. I think your breakdown will help a lot of people.

I thought from looking at the code we most likely were looking at 2 separate pieces of code and were misinterpreting what @leblaaanc meant by combining them. I was able to save his code without error under Device Types. This is actually for a friend’s house so I won’t be able to test that I set things up correctly until tonight.

Alternatively, for those still having trouble and using IOS, there is an app we found called SmartRules for $7 that has a fairly straightforward UI. I was able to create a couple of simple rules in just minutes. Again it’s for IOS so Android users like myself should probably stick with the SmartApp option here.

Great write up Chris. Works great!

What’s a good relay option to implement this solution? I’d prefer something that attaches to the garage door opener rather than the switch that operates it, if possible.


Thank you - had a setup that indicated the open close status and a separate button to press love the combined button/status - now if only I could address my car leaving on its own unexpectedly and then returning a few minutes later and opening my garage door :smile: