ValueTile anatomy?


(Linda Thomas-Fowler) #1

I’ve been looking for some documentation on the parameters to ValueTile without much luck. In What little documentation I find I see examples like:

valueTile("heatingSetpoint", "device.heatingSetpoint", inactiveLabel: false, decoration: "flat") {
    state "heat", label:'${currentValue}° heat', backgroundColor:"#ffffff"
}

What is that second parameter for (“device.heatingSetpoint” in this example)?

Can the ${currentValue} in the label be replaced with something else like ${state.zoneNumber}?

I’m trying to display some configuration data that doesn’t come from an event but I’m having zero luck.


(Bart Wenmeckers) #2

I have been looking for some decent documentation also with no luck. please post back if you find a link.


(Geko) #3

The second argument is the device attribute name. Standard attributes are defined here: https://graph.api.smartthings.com/ide/doc/capabilities

You can define custom attributes in the metadata ‘definition’ section:

attribute "MyAttribute", "string"

and use it just like standard attributes, e.g.:

def foo = device.currentValue("MyAttribute")

(Linda Thomas-Fowler) #4

Thanks, @geko. That was very helpful! I think what I have should be working, but my ValueTile shows “–”.

In the metadata section I have:

attribute "zoneNumber", "number"

Then below in Tiles I have:

        valueTile("zoneNumber", "device.zoneNumber", decoration: "flat") {
            state "default", label:'${currentValue}'
        }	

The zoneNumber attribute is being set via sendEvent and if I look at the device in the ide it shows there zoneNumber having a value of 1 but in the tile on the mobile app it just shows as “–”. I must be missing something simple and obvious.


(Geko) #5

Devices are funky. In my experience, whenever I change device UI, it does not update until I log out of the mobile app, then kill/restart it.


(Linda Thomas-Fowler) #6

Thanks again, @geko. I followed those steps and lo’ and behold it worked. Sigh. It’s hard to debug when you can’t trust what the tools are showing you. Hours wasted and frustration mounted… and my code was right all along. Sigh, again.


(Geko) #7

Hear, hear… Developing for ST is like walking in the mind field. Got to wear a helmet and steel boots at all times :slight_smile:


(Linda Thomas-Fowler) #8

I’ve got another valueTile question. I can make standardTile work the way I expect but valueTile seems to have different semantics than I am expecting. I have this:

		valueTile("status", "device.status") {
		    state "ok", label:'OK',backgroundColor:"#79b821"
		    state "lowBattery", label:'Low\nBattery',backgroundColor:"#ffa81e"
		    state "default", label:'Unknown',backgroundColor:"#333333"
	    }

The “status” attribute is “ok” but “Unknown” is what shows up in the tile display. Anyone have any idea what I’m doing wrong?


(Jody) #9

From what I have gathered if you want to use the various states, use the standard tile. If you want to display a value use the value tile. I would use the standard tile for the example you posted.


(Linda Thomas-Fowler) #10

ST seems pretty restrictive in the way data gets presented. A standardTile would be fine except that I don’t have icons for these and if I use a standardTile the text gets stuffed down in the bottom and there is a large blank area at the top.

If I use a valueTile normally I get unpretty text. There doesn’t seem to be any good way to transform text before display.


(Geko) #11

I agree. Custom tiles give me nothing but endless grief. :-\


(Keith Croshaw) #12

I’ve been trying to think of a way to visualize a small amount of variables that are happening within my SmartApp. Any new creative ways anyone has used tiles to show values? (Virtual device)