Automatically close garage door after X minutes

Good point… now that you mention it, I do recall seeing a Chamberlain MyQ opener on the Wink end cap of my local Home Depot.

I wonder how deep their integration is.

That’s the only thing that works for me in their app. The wink app couldn’t even connect to its own hub. Huh…

If only Garageio wasn’t so swamped with production and funding, I have to imagine they’d love to work with SmartThings.

I created my own integration, but it’s in the very same vain as the current MyQ integration.

Maybe we can buy them :slight_smile:

That is a super nice hack

Would be cool if you wrote a tutorial on how you did it :slight_smile: I have to say this would be super useful and I have not seen a product that would do all of that

2 Likes

For the life of me I cant get this to work. I wonder if it is because I’m using an offset time? I’m telling it 1Hr after, any ideas?

Works fine here. Have you tried running it in the IDE to see where it might be going off into the weeds? What sensor are you inputting?

I’m going to try the ide, I’m putting in LFM for my opener and tilt switch for the door. The LFM and tillt switch work perfectly otherwise.

That is the problem. The app is designed to look for acceleration. The reason for this is that there is a delay on remote closure while the alarm sounds, so it is best to know the moment the door actually starts moving.

You’ll need to modify the app to look for whatever capabilities are supported from the tilt switch (guessing that is simply “open” and “closed”) and dispense with the delay (or use a very short one).

I might have misunderstood what this app was supposed to do. I thought it would check my garage door, say at sunset, and if open close it.

Oops sorry, I was thinking of another app in another thread. Does the LFM even support an ‘off’? I was under the impression it was a momentary closure. If that’s the case you’ll need to modify the switch from “capability.switch” to “capability.momentary”, and the command ‘theDoor.off()’ to ‘theDoor.push()’

Scott, First of all, really I appreciate your help on this.

Yes the LFM is a momentary. I made the above changes and it wasn’t working in the simulator but once I took it out of the simulator and tried it it worked like a charm.

Thanks again Scott!!!

Thanks,
Michael

1 Like

I looked but could not find an app that did what the original author of this thread was looking for (Automatically close garage door after X minutes), so I created a very small and simple script to do just that.

I borrowed most of the code from the “Ridiculously Automated Garage Door for GD00Z” app.

/**
 *  Auto Garage Close
 *
 *  Author: Jim Mulholland (@mully)
 *  Collaborators: @mully
 *  Date: 2015-04-29
 *  URL: 
 *
 * Copyright (C) 2015 Jim Mulholland.
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this
 * software and associated documentation files (the "Software"), to deal in the Software
 * without restriction, including without limitation the rights to use, copy, modify,
 * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to the following
 * conditions: The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

definition(
    name: "Auto Garage Close",
    namespace: "",
    author: "",
    description: "Close an open garage door after X minutes.",
    category: "Safety & Security",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
    iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
    
preferences
{	
	section("Garage door") {
		input "door", "capability.doorControl", title: "Which garage door controller?"
		input "openThreshold", "number", title: "Close when open longer than ",description: "Number of minutes", required: true
	}
}

def installed()
{
	log.trace "installed()"
    subscribe()
}

def updated()
{
	log.trace "updated()"
	unsubscribe()
	subscribe()
    log.debug "Auto Garage Close updated."
}

def subscribe() {
    log.debug "Settings: ${settings}"
	subscribe(door, "door", garageDoorState)
}


def garageDoorState(evt)
{
	log.info "garageDoorState, $evt.name: $evt.value"
	if (evt.value == "open") {
		schedule("0 * * * * ?", "doorOpenCheck")
        log.debug "Schedule Set"
	}
	else {
		unschedule("doorOpenCheck")
        log.debug "Unscheduled"
	}
}

def doorOpenCheck()
{
	final thresholdMinutes = openThreshold
	log.debug "doorOpenCheck -- ${currentState?.value}; thresholdMinutes: ${thresholdMinutes}"
	if (thresholdMinutes) {
		def currentState = door.doorState
		if (currentState?.value == "open") {
			log.debug "open for ${(now() - currentState.date.time)/60000} minutes"
			if (now() - currentState.date.time > thresholdMinutes * 60 *1000) {
				def msg = "${door.displayName} was been open for ${thresholdMinutes} minutes"
				log.info msg
				door.close()
			}
		}
	}
}
2 Likes

Thanks, this is what I needed. I’d be interested in a schedule ability if you’re inclined to add that.

Thank you for this. The other day my sister accidentally left the door open and this solves that problem

I would be interested in this as well. I have forgotten to close my garage and left it open overnight. I would like ST to be able to see that if it’s still open at a specific time that it will close.

Getting the following error message:
Validation Error(s) occurred during save(): - Field error in object ‘physicalgraph.app.SmartApp’ on field ‘author’: rejected value [null]; codes [physicalgraph.app.SmartApp.author.nullable.error.physicalgraph.app.SmartApp.author,physicalgraph.app.SmartApp.author.nullable.error.author,physicalgraph.app.SmartApp.author.nullable.error.java.lang.String,physicalgraph.app.SmartApp.author.nullable.error,smartApp.author.nullable.error.physicalgraph.app.SmartApp.author,smartApp.author.nullable.error.author,smartApp.author.nullable.error.java.lang.String,smartApp.author.nullable.error,physicalgraph.app.SmartApp.author.nullable.physicalgraph.app.SmartApp.author,physicalgraph.app.SmartApp.author.nullable.author,physicalgraph.app.SmartApp.author.nullable.java.lang.String,physicalgraph.app.SmartApp.author.nullable,smartApp.author.nullable.physicalgraph.app.SmartApp.author,smartApp.author.nullable.author,smartApp.author.nullable.java.lang.String,smartApp.author.nullable,nullable.physicalgraph.app.SmartApp.author,nullable.author,nullable.java.lang.String,nullable]; arguments [author,class physicalgraph.app.SmartApp]; default message [{0} cannot be null]

Can you please assist? Thanks

I’m also looking for closing garage door after X minutes, the app isnt fully working properly as mentioned in the post above, i fixed this, but my garage door is not configured as a “garage door” its used as a switch and samsung multisensor, so i get no options to choose. i changed it to the doorControl to a switch now i see my switch but nothing happens. im not very great at programming this can anyone help? thanks

ex:

“input “door”, “capability,switch”,title :Which garage door controller?”

this lets me see the garage door switch im using.

I put together a smartapp that should do what you’re interested in. It makes use of a motion sensor as well as the garage door control, to ensure that the garage door doesn’t close on you if you’re in it after the timeout is reached. The idea being you can be actively using the garage and if it was just a hard timeout it could actually close on you, or your kid, or your car reversing out, etc. This prevents that situation, and only closes after X minutes past since the last activity was detected (or if it was opened, and no activity occurred after a set period of time).