Hello Community,
Let me expand on the topic title a little more…
I understand that you can associate the value of a device attribute with a tile (standardTile, valueTile etc.), and also pull in multiple device attributes’ values using a multiAttributeTile too, but I have been playing around with the various types of tiles for a few days and have not managed to figure out how to achieve what I want in a single tile.
It’s important to note that the type of tile I wish to create will be displayed in the main Things view, using:
main(["<tile_name>"])
I want to take the values of both “device.thermostatMode” and “device.thermostatOperatingState”, perform some logic on those 2 values, possibly create a new variable with the result of the logic operation, and use that new variable’s value in a single tile, which is to be used in the main Things view. Here is some rough pseudo code for what I wish to achieve:
def newVariable = ""
if (device.thermostatMode == "manual" && device.thermostatOperatingState == "idle") {
newVariable = "manualAndIdle"
}
else if (device.thermostatMode == "manual" && device.thermostatOperatingState == "heating") {
newVariable = "manualAndHeating"
}
.....
standardTile("thermostatStatus", "newVariable", inactiveLabel: true, decoration: "flat", width: 2, height: 2) {
state "manualAndIdle", label:'MANUAL', icon: "st.Weather.weather2"
state "manualAndHeating", label:'MANUAL', icon: "st.Weather.weather2", backgroundColor:"#EC6E05"
}
.....
main(["thermostatStatus"])
I’m aware that the above pseudo code probably contains errors that are obvious to people who are more of an expert than I am at SmartThings groovy coding, but hopefully it still communicates what I’m aiming to achieve. Put simply, I want to take the values of two device attributes, combine them, and visually represent them in the main Things view, using both (1) text and (2) colour, for example:
If the mode is MANUAL and the state is IDLE, then display the text “MANUAL” in grey colour
Else if the mode is MANUAL and the state is HEATING, then display the text “MANUAL” in orange colour
Is this possible at all? Any pointers would be much appreciated…
Many thanks in advance,
frazzlegod