Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
metadata {
simulator {
status "locked": "lock:locked"
status "unlocked": "lock:unlocked"
reply "lock": "lock:locked"
reply "unlock": "lock:unlocked"
}
tiles {
standardTile("toggle", "device.lock", width: 2, height: 2) {
state "unlocked", label:'unlocked', action:"lock.lock", icon:"st.locks.lock.unlocked", backgroundColor:"#ffffff"
state "locked", label:'locked', action:"lock.unlock", icon:"st.locks.lock.locked", backgroundColor:"#79b821"
}
standardTile("lock", "device.lock", inactiveLabel: false, decoration: "flat") {
state "default", label:'lock', action:"lock.lock", icon:"st.locks.lock.locked"
}
standardTile("unlock", "device.lock", inactiveLabel: false, decoration: "flat") {
state "default", label:'unlock', action:"lock.unlock", icon:"st.locks.lock.unlocked"
}
main "toggle"
details(["toggle", "lock", "unlock", "refresh"])
}
}
def parse(String description) {
def pair = description.split(":")
createEvent(name: pair[0].trim(), value: pair[1].trim())
}
def lock() {
"lock"
}
def unlock() {
"unlock"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment