Last active
December 28, 2015 03:29
-
-
Save dburman/7435962 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
/** | |
* Delayed Refresh | |
* | |
* Author: scott | |
* Date: 2013-11-11 | |
*/ | |
preferences { | |
section("Refresh this device") { | |
input "theSwitch", "capability.switch", multiple: false | |
} | |
} | |
def installed() { | |
log.debug "Installed with settings: ${settings}" | |
initialize() | |
} | |
def updated() { | |
log.debug "Updated with settings: ${settings}" | |
unsubscribe() | |
initialize() | |
} | |
def initialize() { | |
subscribe(theSwitch, "display", switchHandler, [filterEvents:false]) | |
} | |
def switchHandler(evt) { | |
if(evt.name == "display") | |
{ | |
try { | |
log.debug "refresh Test Board" | |
theSwitch.refresh(delay:2000) | |
} catch(Exception e) { | |
log.error "Encountered error trying to refresh Test Board switch: $e" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment