Automatically close garage door after X minutes

IM using a zwave switch to control my garage door. Has anybody created a smart app that after my garage door has been opened it will automatically close. like when i come home and it opens. after im in the house for 5 minutes and my motion sensor in the garage doesnt detect motion have the garage door automatically close. also I would like to have an app that if my garage door is still open at 9pm close it. Can anybody help with this?

Just my 2 cents from a novice member. However solid the SmartApp is, I can never rely on this feature due to safety issue. My chamberlain MyQ has this built in and have never set it. Call me paranoid but I don’t want it crashing over somebody’s head or my car. So, I take the extra step of pressing a button to close it. Although set myself up to be notified if I leave the door open for a certain period.

Here is one that I created to close my door at sunset. It has an offset so you can set it activate it earlier or later if desired.

/**
 *  Garage After Dark
 *
 *  Author: Scottin Pollock
 *
 *  Date: 2014-06-15
 *  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.
 */
 
definition(
    name: "Garage After Dark",
    namespace: "soletc.com",
    author: "Scotin Pollock",
    description: "Closes Garage and sends notification when garage door is open during sunset times.",
    category: "My Apps",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/garage_contact.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/garage_contact@2x.png"
)

preferences {
    section("Close if garage door is open...") {
		input "contact1", "capability.contactSensor", title: "Which Sensor?"
		input "theDoor", "capability.switch", title: "Which Door?"
	}
	section ("Sunset offset (optional)...") {
		input "sunsetOffsetValue", "text", title: "HH:MM", required: false
		input "sunsetOffsetDir", "enum", title: "Before or After", required: false, metadata: [values: ["Before","After"]]
	}
	section ("Zip code (optional, defaults to location coordinates)...") {
		input "zipCode", "text", title: "Zip Code", required: false
	}
	section( "Notifications" ) {
		input "sendPushMessage", "enum", title: "Send a push notification?", metadata:[values:["Yes", "No"]], required: false
		input "message", "text", title: "Message to send...", required: false
	}
}

def installed() {
	initialize()
}

def updated() {
	unschedule()
	initialize()
}

def initialize() {
	scheduleAstroCheck()
	astroCheck()
}

def scheduleAstroCheck() {
	def min = Math.round(Math.floor(Math.random() * 60))
	def exp = "0 $min * * * ?"
    log.debug "$exp"
	schedule(exp, astroCheck) // check every hour since location can change without event?
    state.hasRandomSchedule = true
}

def astroCheck() {
	if (!state.hasRandomSchedule && state.riseTime) {
    	log.info "Rescheduling random astro check"
        unschedule("astroCheck")
    	scheduleAstroCheck()
    }
	def s = getSunriseAndSunset(zipCode: zipCode, sunriseOffset: sunriseOffset, sunsetOffset: sunsetOffset)

	def now = new Date()
	def setTime = s.sunset
	log.debug "setTime: $setTime"
	if (state.setTime != setTime.time) {
		state.setTime = setTime.time

		unschedule("sunsetHandler")

		if (setTime.after(now)) {
			log.info "scheduling sunset handler for $setTime"
			runOnce(setTime, sunsetHandler)
		}
	}
}

def sunsetHandler() {
	log.info "Executing sunset handler"
    def Gdoor = checkGarage()
       if (Gdoor == "open") {
       	send(message)
        theDoor.off()
        }
	unschedule("sunsetHandler") // Temporary work-around for scheduling bug
}

private send(msg) {
	if ( sendPushMessage != "No" ) {
		log.debug( "sending push message" )
		sendPush( message )
	}

	log.debug message
}

def checkGarage(evt) {
	def latestValue = contact1.currentContact
}

private getSunsetOffset() {
	sunsetOffsetValue ? (sunsetOffsetDir == "Before" ? "-$sunsetOffsetValue" : sunsetOffsetValue) : null
}

Thanks I’ve been looking for something like this!!!

Thanks
 But something else I literally just had happen. Is there an app that will notifiy me if my garage door doesnt close when i tell it to. For example I left today and smartthings closes the garage door automatically when the car leaves. Well something was blocking the sensor and the door never closed. Smarthings notifies me that its closing the door. I would like a notification that is didnt close so I can return home and see why its not closing.

None that I know of.

there is a dashboard option that says alert me if the door is open for more than X minutes which you can make only for away mode.

however there is an “bug/feature” that doesn’t count if the door was already open when the mode changed to away. For that you can use @gbronzer 's app.

Wouldn’t the safety laser thing still be intact? This command wouldn’t override that. So if someone or ting was in the way, the door wouldn’t come down. Right?

@ben I said I am so paranoid being a first time home owner with a sixties house here in Jersey even though it’s a brand new so called highest end Chamberlain garage opener and got all the alignment and all the works on the garage door door but when even on a brand new opener if the stupid door doesn’t close when sun shines directly on the sensor, it make its much worse and me nervous. I do trust the apps but not “my” door!

Depends on who installed the door. If it was done professionally, those sensors are no more than 6 inches off the ground. That’s ok for a crawling baby or a toy dachshund, but not for a car unless the wheels are perfectly situated across the beam.

When I installed my new 8500, I mounted them at 22" so if any part of my truck was in the way, the door would not close. With that said the newer models that support remote commands beep and blink for 5 to 10 seconds before they close in the effort to get someone’s attention who might be in the way. For the most part, I simply see that as annoying.

BTW, have you guys tried to open a dialog with Chamberlain regarding official integration? It would be nice to see given they are the de facto standard in GDO’s.

Sears home services!

There is a way to help with this but it would take modifying the stock app. Add runIn() to schedule a check of the door state a minute or two after the close command. If it is not ‘closed’, send a notification.

1 Like

Believe me I trust the garage app here on ST more than the stock Chamberlain MyQ app which very often gives me the door close error for no particular reason!

This. The safety laser isn’t enough unless you have several lasers in series or they act as a “wall” meaning something 6 ft up or so will also stop it. I don’t know of any that work this way.

Automatic opening, and notifications to our phones for closing work great. Can still be manually closed remotely.

The laser on my Genie works good for people/pets in the way, but it allowed me to wack my car a few times. That’s when I hacked up a device to tell me when the car was not all the way in. It’s a ultrasonic device. I modified a project I found on the net to work with SmartThings. Google “Parking Spotter”. The door won;t close if it is “not safe”. The device also tells me the distance left to the wall.

2 Likes

To get UL listing, it must have a visual and audio warning for any unattended operation. From what I understand, many retailers will not carry it if it is not UL listed.

To that I am certain. Same thing for double tumbler deadbolts (the only place you can get them now-a-days is from a locksmith). Big brother watching out for us, except when you want to secure a door that has some glass in it, in which case break glass; reach inside; unlock deadbolt. (c;

Companies like Chamberlain seem very hesitant to integrate due, in large part, to perceived or real liability concerns. Sort of a shame and maybe they will come around.

I really can’t blame them for that given you can sue Micky D’s (and win) for spilling coffee on yourself while driving.

And they are willing to go with Winky, the crap? I posted my experience today trying to set it up as a newbie.