Turn off a plug when open door



That would be nice if we can turn a plug off is it on at a specific time and the door open

(what I trying to do its : turn the fan off at morning when I’m leaving the room)

(Jas. Powell) #2

I just made one of these by modding one of the example smartapps. Works great. I needed mine to turn off a desk lamp when I leave my office.

    name: "Turn something off when a contact opens",
    namespace: "jaspowell",
    author: "Jas. Powell",
    description: "Turns something off when a contact is opened",
    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 ("When the door opens...") {
		input "contact1", "capability.contactSensor", title: "Where?"
	section ("Turn off a light...") {
		input "switch1", "capability.switch"

def installed()
	subscribe(contact1, "contact.open", contactOpenHandler)

def updated()
	subscribe(contact1, "contact.open", contactOpenHandler)

def contactOpenHandler(evt) {