Last active
August 29, 2015 14:08
-
-
Save tylerlange/a8fb815f2c6949546040 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Darken Behind Me | |
* | |
* Author: SmartThings | |
*/ | |
definition( | |
name: "Darken Behind Me", | |
namespace: "smartthings", | |
author: "SmartThings", | |
description: "Turn your lights off after a period of no motion being observed.", | |
category: "Convenience", | |
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/light_motion-outlet.png", | |
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/[email protected]" | |
) | |
preferences { | |
section("When there's no movement...") { | |
input "motion1", "capability.motionSensor", title: "Where?" | |
} | |
section("Turn off a light...") { | |
input "switch1", "capability.switch", multiple: true | |
} | |
} | |
def installed() | |
{ | |
subscribe(motion1, "motion.inactive", motionInactiveHandler) | |
} | |
def updated() | |
{ | |
unsubscribe() | |
subscribe(motion1, "motion.inactive", motionInactiveHandler) | |
} | |
def motionInactiveHandler(evt) { | |
switch1.off() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment