Skip to content

Instantly share code, notes, and snippets.

@aurman
Created September 10, 2013 12:22
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 aurman/6508643 to your computer and use it in GitHub Desktop.
Save aurman/6508643 to your computer and use it in GitHub Desktop.
/**
* Momentary Button Tile
*
* Author: SmartThings
*
* Date: 2013-05-01
*/
metadata {
// simulator metadata
simulator {
}
// UI tile definitions
tiles {
standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
state "off", label: 'Push', action: "momentary.push", backgroundColor: "#ffffff", nextState: "on"
state "on", label: 'Push', action: "momentary.push", backgroundColor: "#53a7c0"
}
main "switch"
details "switch"
}
}
def parse(String description) {
}
def push() {
sendEvent(name: "switch", value: "on", isStateChange: true, display: false)
sendEvent(name: "switch", value: "off", isStateChange: true, display: false)
sendEvent(name: "momentary", value: "pushed", isStateChange: true)
}
def on() {
push()
}
def off() {
push()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment