Created
June 22, 2015 15:00
-
-
Save jgallen23/ec4bc0c43390a2abf52e to your computer and use it in GitHub Desktop.
momentary button
This file contains hidden or 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
/** | |
* Momentary Button Tile | |
* | |
* Author: SmartThings | |
* | |
* Date: 2013-05-01 | |
*/ | |
metadata { | |
// Automatically generated. Make future change here. | |
definition (name: "Momentary Button Tile", namespace: "smartthings", author: "SmartThings") { | |
capability "Actuator" | |
capability "Switch" | |
capability "Momentary" | |
capability "Sensor" | |
} | |
// 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