Skip to content

Instantly share code, notes, and snippets.

@dburman
Last active December 28, 2015 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dburman/7435962 to your computer and use it in GitHub Desktop.
Save dburman/7435962 to your computer and use it in GitHub Desktop.
/**
* 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