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
metadata { | |
simulator { | |
// reply messages | |
["strobe","siren","both","off"].each { | |
reply "$it": "alarm:$it" | |
} | |
} | |
tiles { | |
standardTile("alarm", "device.alarm", width: 2, height: 2) { | |
state "off", label:'off', action:'alarm.strobe', icon:"st.alarm.alarm.alarm", backgroundColor:"#ffffff" | |
state "strobe", label:'strobe!', action:'alarm.off', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13" | |
state "siren", label:'siren!', action:'alarm.off', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13" | |
state "both", label:'alarm!', action:'alarm.off', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13" | |
} | |
standardTile("strobe", "device.alarm", inactiveLabel: false, decoration: "flat") { | |
state "off", label:'', action:"alarm.strobe", icon:"st.secondary.strobe", backgroundColor:"#cccccc" | |
state "siren", label:'', action:"alarm.strobe", icon:"st.secondary.strobe", backgroundColor:"#cccccc" | |
state "strobe", label:'', action:'alarm.strobe', icon:"st.secondary.strobe", backgroundColor:"#e86d13" | |
state "both", label:'', action:'alarm.strobe', icon:"st.secondary.strobe", backgroundColor:"#e86d13" | |
} | |
standardTile("siren", "device.alarm", inactiveLabel: false, decoration: "flat") { | |
state "off", label:'', action:"alarm.siren", icon:"st.secondary.siren", backgroundColor:"#cccccc" | |
state "strobe", label:'', action:"alarm.siren", icon:"st.secondary.siren", backgroundColor:"#cccccc" | |
state "siren", label:'', action:'alarm.siren', icon:"st.secondary.siren", backgroundColor:"#e86d13" | |
state "both", label:'', action:'alarm.siren', icon:"st.secondary.siren", backgroundColor:"#e86d13" | |
} | |
standardTile("off", "device.alarm", inactiveLabel: false, decoration: "flat") { | |
state "default", label:'', action:"alarm.off", icon:"st.secondary.off" | |
} | |
main "alarm" | |
details(["alarm","strobe","siren","test","off"]) | |
} | |
} | |
def strobe() { | |
"strobe" | |
} | |
def siren() { | |
"siren" | |
} | |
def both() { | |
"both" | |
} | |
def off() { | |
"off" | |
} | |
// Parse incoming device messages to generate events | |
def parse(String description) { | |
def pair = description.split(":") | |
createEvent(name: pair[0].trim(), value: pair[1].trim()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment