Help with virtual garage door driver

I installed this app and driver combo from ST, seems to work correctly in an unmodified state. Only thing I've found is that Hubitat doesn't see it as a garage door control device on the dashboard. When I add a tile for it using garage-control type, it's blank. What needs to be done with the code to make it show in the dashboard?

Driver code:

From this post:

1 Like

I'm not expert but I don't see anything in there for contact sensor. Assuming the switch is for ON/OFF there should be something to confirm open/closed?

It's an app and driver combo, I just posted the driver link. The app allows you to select an acceleration and contact sensor to go along with it.

but wouldn't the driver need to mimic that contact sensor if you are picking it as the "device"? Again...don't put too much weight into what I'm saying. But I can see the "Garage Door" template thinking it's going to get certain parameters....one of which would be a contact sensor. Because this combo is really two devices, how would the dashboard know?

Ah gotcha... And I don't know :rofl:

Both the Capability "Garage Door Control" and "Door Control" have identical intrinsic attributes which define the state of the door. There is no need to add the Capability Contact Sensor as well, although many garage door drivers do so to make it easier to integrate with Apps that only support Contact Sensor devices.

https://docs.smartthings.com/en/latest/capabilities-reference.html#door-control
https://docs.smartthings.com/en/latest/capabilities-reference.html#garage-door-control

I am not sure why the Hubitat Dashboard would not pick up this device as a Garage Door Control/Door Control device. @patrick could explain it though... :wink:

4 Likes

I believe the dashboard uses the contact attribute to display the state of the garage door. You would probably need to add the events to the open/closed methods in the driver.

sendEvent(name: "contact", value: "open")

sendEvent(name: "contact", value: "closed")

Edit: forgot to mention, you would need to add the capability as well.
capability "Contact Sensor"

1 Like

Just tested and it seems to work. Don't forget to click open or close once so the state gets initailized:

/**
 *  Virtual Garage Door
 *
 *  Copyright 2017 Patrick McKinnon
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 *  Author: Patrick McKinnon (patrick@ojolabs.com)
 */
metadata {
    definition (name: "Virtual Garage Door", namespace: "pmckinnon", author: "patrick@ojolabs.com") {
        capability "Actuator"
        capability "Door Control"
		capability "Contact Sensor" //added for HE dashboard
        capability "Garage Door Control"
        capability "Switch"

        command "setVirtualGarageState"
    }

    simulator {

    }

    tiles {
        standardTile("toggle", "device.door", width: 2, height: 2) {
            state("closed", label:'${name}', action:"door control.open", icon:"st.doors.garage.garage-closed", backgroundColor:"#79b821", nextState:"opening")
            state("open", label:'${name}', action:"door control.close", icon:"st.doors.garage.garage-open", backgroundColor:"#ffa81e", nextState:"closing")
            state("opening", label:'${name}', icon:"st.doors.garage.garage-closed", backgroundColor:"#ffe71e")
            state("closing", label:'${name}', icon:"st.doors.garage.garage-open", backgroundColor:"#ffe71e")

        }
        standardTile("open", "device.door", inactiveLabel: false, decoration: "flat") {
            state "default", label:"open", action:"door control.open", icon:"st.doors.garage.garage-opening"
        }
        standardTile("close", "device.door", inactiveLabel: false, decoration: "flat") {
            state "default", label:"close", action:"door control.close", icon:"st.doors.garage.garage-closing"
        }

        main "toggle"
        details(["toggle", "open", "close"])
    }
}

def open() {
    log.debug "open()"
    sendEvent(name: "switch", value: "on")
	sendEvent(name: "contact", value: "open")  //added for HE dashboard
}

def close() {
    log.debug "close()"
    sendEvent(name: "switch", value: "off")
	sendEvent(name: "contact", value: "closed")  //added for HE dashboard
}

def setVirtualGarageState(config) {
    log.debug("setVirtualGarageState($config)")
    sendEvent(name: "door", value: config["door"])
    if(config["door"] == "open") {
        sendEvent(name: "switch", value: "on")
		sendEvent(name: "contact", value: "open") //not sure how this is used by app but added here because I assume it would be needed
    }
    else if(config["door"] == "closed") {
        sendEvent(name: "switch", value: "off")
		sendEvent(name: "contact", value: "closed") //not sure how this is used by app but added here because I assume it would be needed
    }
}

image

1 Like

Awesome! I'll load it up when I get home. Appreciate the help :grin:

I feel like I was at least close.... LOL

3 Likes

You definitely were! It just feels like a bug in the Hubitat Dashboard to require a contact sensor capability, when the door control/garage door control capability already has the necessary information.

2 Likes

Confirmed working, thank you!!

1 Like

it won't work for me after the first time it opened. still working for you ?

Yep, no issues here.

Yeah nevermind. It's my contact sensor not registering. Hopefully that's also why the icon is showing up as a blank. I made the change showed above. I have a new tilt sensor on the way so hopefully that will solve the problem

1 Like

Any idea how to make it work with a tilt sensor (ST multipurpose sensor)? It's functioning correctly, but the icon doesn't indicate open/closed or function as a press button when template is set to garage control

My garage door integration is all in one so I don't have to tie 2 devices together (door operation and door status) like you do.

The below is just my best guess since I don't have your setup and I also no longer use the dashboard. Hopefully someone with your exact setup will chime in or maybe @patrick can assist.

2 Options I believe you have:

  • You can create 2 separate tiles (one for control and one for status).
  • or you can try to have the control tile sit on top of the status tile (the control tile will have to be transparent).

While I know this should be doable, I no longer use the dashboard so I won't be able to walk you through the necessary steps.

Good Luck.

What are you doing for your dashboard? I tried setting the template as garage and garage-control and neither are showing up properly.

I have mine set up as garage-control

Weird. I'm getting a blank tile for that option. It also gets stuck 'opening'. I think that's my acceleration sensor though