schettj
(John S)
May 10, 2015, 4:41pm
18
LOL Wish I had read this thread yesterday.
This is my “solution” to do exactly what you were trying to do - all the way down the thread, I implement “shadow attributes” to have states with different tile colors.
This question was asked not long ago… and I now find myself asking it again!
Say I’ve defined a custom attribute in my meta section:
attribute "tamper", "string" //, enum ["clear", "detected"] actually, but we digress
Awesome. Now, I can set that attribute via sendEvent just dandy in the device handler. I can use it’s current value (sorta) in the tiles section as expected:
standardTile("tamper", "device.tamper") {
state("clear", label:'secure', icon:"st.security.alarm.clear", backgroundColor:"#79b821")
state("detected", label:'tampered', action:"resetTamperAlert", icon:"st.security.alarm.alarm", backgroundColor:"#e3eb00")
}
Awesome. Now say I want to make a color method which returns one of two color codes based on the value in tamper. This doesn’t do it:
def color() {
…
1 Like