Well, you can't use the stock virtual garage door driver. Here is one you have to use.
/**
* Virtual Garage Door
*
*/
metadata {
definition (name: "Virtual Garage Door", namespace: "ryan780", author: "ryan780") {
capability "Actuator"
capability "Contact Sensor"
capability "Garage Door Control"
capability "Switch"
command "confirmOpen"
command "confirmClosed"
}
}
def open() {
log.debug "open()"
on()
}
def close() {
log.debug "close()"
on()
}
def on(){
sendEvent(name: "switch", value: "on")
runIn(3,off)
}
def off(){
sendEvent(name: "switch", value: "off")
}
def confirmClosed(){
sendEvent(name: "door", value: "closed") //added for HE dashboard
sendEvent(name: "contact", value: "closed") //added for HE dashboard
}
def confirmOpen(){
sendEvent(name: "door", value: "open") //added for HE dashboard
sendEvent(name: "contact", value: "open") //added for HE dashboard
}
This driver will turn on when the open command is issued from the dashboard but won't show status of open until you issue it the "confirmOpen" command. So, what you have to do is go into rule machine and set up a rule with your contact sensor that is triggered off it changing, you then would do the custom action of "confirmOpen" when the contact sensor is opened and "confirmClosed" when the contact sensor is opened.
To trigger whatever mechanism you are suing to open the door, it has a simple momentary switch that will be on for 3 seconds whenever an open or close event is triggered. This way, the device works correctly if you use another device, such as a local button, to also open and close the garage door. In your case, you would use a time function that turn the relay on for one second every time the switch is on in the virtual device.
The other great thing about using the Garage Door (control) tile is that it asks you to confirm that you really want to open or close the door, which i just love!