Hello, Home - Can it close a garage door?

I’d like to have my “Good Night” mode ensure that my garage doors are closed.

Is this possible?

1 Like

I havent seen anything in the Hello Home commands that allow you to check the state of a sensor prior to activating. It only allows you to issue actions like turn a switch on or off, yada yada.

You could use a MIMOlite as a switch that can be triggered by the Good Night action…unfortunately its momentary so it may end up opening your door since most garage doors dont have discrete open and close contact closures. If yours does, then you are golden.

If not…
I havent gotten too deep into groovy but it may be possible to put somewhere in the MIMOlite device code you might be able to create a virtual switch that when it gets the switch trigger it checks the door sensor (which can be wired into the MIMO) before issuing the momentary closure to activate the door.

…possibly a bit over compliated but very handy if you get it working!

ok…even better, if you can code the MIMOlite to be treated as a door lock, the lock command would check the door sensor that it is open and will close the door. the unlock command would check the door that it is closed and open it.

…hmmm wish I had a garage to test

I actually wanted this exact feature. I tried using the feature “if door left open X minutes”, but that doesn’t work if the mode changes and the door is already open. So I wrote my own smart app to do it. Assuming your garage door has an open/close sensor, my app supports two notification modes. You can choose a set of modes or a specific time. When the mode changes to a selected mode or the time hits, it will check the state of the monitored door and alert you if it’s open. I didn’t have it auto-close because I’m just nervous about closing a door on top of someone just because they happened to be leaving.

If you know how to use the dev console to install your own apps, I’m happy to provide the source. Otherwise you’ll have to wait until I’ve tested it a bit more and I’ll submit it for public approval.

I can definitely write my own, it just seemed like something that should already be in there.

I’m not sure about the auto-close either, but I’d only be having it close on a manual mode switch when I know where the wife, kid, and dog are. Anyone else that gets clipped by the door, well… that’ll teach 'em to trespass. =)

2 Likes

Well, if you’re interested, I went ahead an shared my source. Just create a new app in the dev tool, then click “Browse SmartApps” in the upper right. Look for “Is It Closed?” Then you can simply install it for your own use or tweak it however.

Before writing this app I actually did bring up the issue with a SmartThings dev. He said it just wasn’t on the “to do” list.

1 Like

Hope this is ok to share your code here as well:

/**
 *  Is It Closed?
 *
 *  Copyright 2014 Greg Bronzert
 *
 *  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: "Is It Closed?",
    namespace: "gbknet",
    author: "Greg Bronzert",
    description: "Check whether door is closed after a mode change or specific time.",
    category: "Convenience",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png"
)


preferences {
	section("Which mode changes trigger the check?") {
		input "newMode", "mode", title: "Which?", multiple: true, required: false
	}
    section("When should I check? (once per day)") {
    	input "timeToCheck", "time", title: "(Optional)", required: false
    }
    section("Which door should I check?"){
		input "door", "capability.contactSensor", title: "Which?", multiple: false, required: true
    }
}

def installed() {
	log.debug "Installed with settings: ${settings}"

	initialize()
}

def updated() {
	log.debug "Updated with settings: ${settings}"

	unsubscribe()
    unschedule()
	initialize()
}

def initialize() {
	if (newMode != null) {
		subscribe(location, modeChangeHandler)
    }
    if (timeToCheck != null) {
    	schedule(timeToCheck, checkDoor)
    }
}

def modeChangeHandler(evt) {
	log.debug "Mode change to: ${evt.value}"
    
    // Have to handle when they select one mode or multiple
    if (newMode.any{ it == evt.value } || newMode == evt.value) {
		checkDoor()
    }
}

def checkDoor() {
    log.debug "Door ${door.displayName} is ${door.currentContact}"
   	if (door.currentContact == "open") {
       	def msg = "${door.displayName} was left open!"
        log.info msg
        sendPush(msg)
    } else {
       	log.debug "It wasn't open."
    }
}
1 Like

this is great. Just yesterday I noticed my garage was open for more than 2 minutes and it didn’t notify me as I thought it would. It was because I opened it then changed modes. Thanks @gbronzer Is it possible for someone to post what needs to be added if we want the door to auto close? I’m not worried about it closing on someone because the beam detectors are there for that reason.

Don’t you have to convert your time like so?

schedule(timeToday(timeToCheck, location.timeZone), “checkDoor”)

This wouldn’t be too hard. There’s already an app that does this. You can just copy it’s code for the switch and add it to mine. The tricky part is that some people have relays that need to be turned on, then off (like this sample program), and some have ones that do it automatically. So this sample assumes you have to switch it on, then off.

As far as I can tell, they don’t offer easy access to the garage door device type that already exists within the app and is aware of the type of switch used.

/**
 *  Garage Door Opener
 *
 *  Author: SmartThings
 */
definition(
    name: "Garage Door Opener",
    namespace: "smartthings",
    author: "SmartThings",
    description: "Open your garage door when a switch is turned on.",
    category: "Convenience",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/garage_outlet.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/garage_outlet@2x.png"
)

preferences {
	section("When the garage door switch is turned on, open the garage door...") {
		input "switch1", "capability.switch"
	}
}

def installed() {
	subscribe(app, appTouchHandler)
	subscribeToCommand(switch1, "on", onCommand)
}

def updated() {
	unsubscribe()
	subscribe(app, appTouchHandler)
	subscribeToCommand(switch1, "on", onCommand)
}

def appTouch(evt) {
	log.debug "appTouch: $evt.value, $evt"
	switch1?.on()
}
    
/* Don't need this if your switch turns off automatically */
    def onCommand(evt) {
    	log.debug "onCommand: $evt.value, $evt"
    	switch1?.off(delay: 3000)
    }

Honestly I’m not sure. It obviously infers the timezone since it worked properly for me. I’ll try changing it because it seems like it’d be safer with that method. A quick look through other apps doesn’t show it used much for simple schedules like this one.

I cut and pasted in what you added, but I can’t save it without errors. I’m sure I’m just not pasting it in the right place.
My relay is the virtual momentary contact switch.

But your app as it is works great. The only part I don’t understand in the set up is - you pick the mode change that triggers the test. But then at the bottom it asks (optional) to set for specific modes? I’m not sure what picking a mode there would do?

I didn’t add that section. It seems to be automatically added by the core SmartThings API to allow users to disable a SmartApp in certain modes. It kinda conflicts with what my app does and I agree it’s confusing but I can’t remove it. Just ignore that section.

Yes that and the rename feature are always added. We should probably allow an override from an app developer on that to avoid confusion.

1 Like

@Ben Not always. I use dynamicPage in a couple of my apps and those fields are not added. I DO want them, though. How do I ADD them from the app?

I have to clarify - I know how to add fields, I don’t know which API to call to do the actual renaming.

Also, I’ve been looking at this device: (It also has outputs and inputs… all low voltage) A little cheaper…

http://www.amazon.com/gp/product/B001OLVLCK/ref=ox_sc_sfl_title_2?ie=UTF8&psc=1&smid=ATVPDKIKX0DER

Test on my Leviton relay.

Can you give me the code?

If you mean the source code to the “Is It Closed?” app, it’s in this thread posted by Ben.