Switching between Tiles

Hi,

I am trying to achieve the below image by coding this in my tileAttribute.

So I have a standardTile, called mode, and when I am in “mode 1”, the arrow pointed up shows what the tileAttribute will switch between everytime I press it.

When I am in “mode 2”, the arrow points to what the tileAttribute will switch between everytime I press it.

So “mode 1” allows me to switch between open, stop, and close in the tileAttribute, while “mode 2” allows me to switch between open and close in the tileAttribute.

How can I code all this? I’d really appreciate any help.

The Tiles in a Device Type cannot be dynamically hidden / shown (as far as I know).

Keep in mind that you have a “third” state for this Device: open, close are the normal binary states (for a door, garage door, projector screen); but stop is the special case, right?

I implemented this in my Projector Screen DTH by using a different Attribute to indicate whether the screen movement was “enabled” or “disabled”.

This might be one way to help distinguish the “stop” Tile as a separate Tile from open/close (or open/close being a toggle Tile with transitory states “opening” and “closing”.

Here’s a link to my DTH. It certainly doesn’t do what you describe so clearly; but you might find some ideas here:

1 Like

The way to implement this would be to handle the switching logic in a method/handler. The tile should have all 3 states and the handler should update the tile attribute value so the tile will then reflect the new state.

1 Like

Is there a way to do something like the below? It’s not working code, but I wanted to know if there was a way to do something like this.

multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
    tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
    	[value:"02", {   // mode2
            attributeState "on", label:'Open', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#00A0DC", nextState:"turningOff"
            attributeState "off", label:'Closed', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
            attributeState "turningOn", label:'Opening', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#00A0DC", nextState:"turningOff"
            attributeState "turningOff", label:'Closing', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
        }],
        [value:"01", {   // mode1                	
            attributeState "on", label:'Open', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#00A0DC", nextState:"stop1"
            attributeState "off", label:'Closed', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"stop2"
            attributeState "stop1", label:'Stop', action:"stop", backgroundColor:"#cccccc", nextState:"off"
            attributeState "stop2", label:'Stop', action:"stop", backgroundColor:"#cccccc", nextState:"on"
        }],
    }
}

There may be secret tricks in the Tile description language that do things that some or none of us have never discovered; so it doesn’t hurt to ask here; but the odds of finding out are very low.

Most engineers at SmartThings wouldn’t even know!

Officially, all we have is docs.smartthings.com and dynamically changing the set of Tiles is not possible. You just have to get clever with Attribute state values and, as @RBoy mentioned, using a SmartApp to manipulate the states. Keep in mind that there are anomalies that can occur if you do to much manipulation of states within the DTH. I don’t know what “too much” is; just know that SmartThings has many quirks.


The best answer? If you want this to be optimal, wait a couple or a few months. SmartThings has a whole new API and it includes a “Panel describer” for Things that uses html/javascript-like syntax instead of Groovy. Much more powerful control will be available.

But I think the documentation isn’t even up yet.

https://smartthings.developer.samsung.com/develop/guides/hub/overview.html