Can a valueTile have more than one dynamic value?


(Ron) #1

I emailed this question to support and they replied that I should post it to the community.
Wish I could get an answer from the horses mouth so I knew it was right. They do still have the original code for this thing don’t they ?

Anyway here goes…

Since the api for valueTile is not in the developer documentation I am
hacking away trying to figure it out.

Is his tile documented ?

Specifically I am trying to get two dynamic values in this tile.

I see that the Aeon MultiSensor uses two variable values in a valueTile
currentValue and unit and it works fine.

valueTile(“illuminance”, “device.illuminance”, inactiveLabel: false) {
state “luminosity”, label:’${currentValue} ${unit}’, unit:“lux”
}

In this case “Unit” is not really variable because it never changes. So
I don’t know if it is “Dynamic”

I am trying to make a valueTile with two dynamic values but nothing I
try works. It crashes the app as soon as I add a second value.

Here is what I tried
valueTile(“temperatureName”, “device.temperatureName”, inactiveLabel:
false) {
state “temperatureName”, label:’${currentValue}
${shortName}’, unit:"", shortName=""
}

Is it possible to have more than one dynamic value in a valueTile ?
Is value tile hard coded to only allow currentValue and unit ?

map.value = convertTemperatureIfNeeded(cmd.scaledSensorValue, cmdScale)
map.unit = getTemperatureScale()
map.shortName = “test”

Another solution is to change map.value to be the full string
map.value = convertTemperatureIfNeeded(cmd.scaledSensorValue, cmdScale)

  • " " + shortName;

But this causes the tile to fail to display. It just displays “–”

I found that if I add decoration: “flat” to the tile it works but it’s
ugly. Since I lose any ability to set colors, icons etc.

Second Question: With valueTile I find that if icon is set, it no
longer displays label. Is this a default behavior with an option to
display the value as well as the icon or is it hard coded to only
display label if icon is not set ?
standardTile allows both icon and label to be set. I don’t understand
why valueTile would be different.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Each mobile platform has different bugs related to Tile display (and the Simulator is the 4th platform).

So that doesn’t answer your question, but just warning you that the results will not be consistent.

And, no, at this time the documentation does not exist. I would sat that’s incredible, but I think it is actually typical of fast growth companies… “code first, document once we’ve been acquired”.


(Ron) #3

What is the 3rd platform ? Assuming 1/2 are Android/iPhone (or iPhone/Android) :smile:

Not to sound like a crotchety old man but that is one of the main things I hate about the current generation of developers. If this was open source I would understand but if it’s closed at least supply the API…I know we have had this discussion before but I think it matters :frowning:

So from your response I would take it that I should just suck it up and forget about the fact that I have no idea how to code this correctly :wink:

I was hoping someone with access to the smart things code would just look at the code and see how it would behave. Does that ever happen or am I wasting my time ?


[RELEASE] GoControl Door/Window Sensor, Motion Sensor, and Siren DTH
(Geko) #4

I don’t have access to ST source code (other than what’s available in IDE) and therefore cannot give you authoritative answer, but I tried what you did long time ago and it didn’t work, so unless something changed recently (unlikely), the answer is ‘no’.

Value tile is briefly documenter here:
http://docs.smartthings.com/en/latest/device-type-developers-guide/anatomy-of-a-device-type.html?highlight=valuetile

so it’s not fair to say that it’s not documented. There’s a full-time tech writer on ST team now. I think your best bet is to ping him directly.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #5

Windows Mobile has been supported for a few months. (iOS, Android, Windows Mobile, Simulator …, HTML5 is next, but probably not a full replica of the apps).

I agree that it matters; I have no idea what SmartThings’s internal source code looks like, but the Community is somewhat grateful that so much of the Device Handlers and SmartApp code is shared and available with just a click in the IDE environment. On the other hand, it is notable that the template and examples written by ST has hardly any comments. In a world that now has inline documentation generation capabilities (Javadoc, etc.), that vague state is disappointing. From my experience in the past doing black-box testing at a rather large software company, I’m actually not surprised at the lack of publishable specs, comments, and substantial developer guides. ST has had to be very lean for their first couple of years, and delivered quite a platform despite challenges from all directions.

No “sucking up” required… – the official “best” channel to get your question answered is Support@SmartThings.com … but, yes, that is indeed where you started. Fact is, they know that there are a lot of bright and experienced and “freely available” folks out here in the Community who represent a vast cache of knowledge (like @Geko, and, me – sometimes I’m bright too!), so I am not surprised that they recommended you ask here.

Overall, SmartThings’s support is top notch, but they know they are faced with the limited resource availability of the engineers that could look through the source code or have the specs in their heads. The entire company is aware of the importance of better documentation, yet they have lots of high priority projects to shuffle: In a general, but true statement, SmartThings’s bread and butter is the mass consumer, and major partners (including their owner, Samsung!). The 3rd party developers are important, but something has to fall lower on the list. So their staffing growth was likely focused on consumer level support and on platform speed and stability.

Yes – that does happen. You can tag certain SmartThings experts here on the Forum and they will get ping’d, though I don’t know exactly “who’s who” and thus the best @ tags to use. If you don’t get the information or help you need from the Community, then there’s nothing wrong in asking Support to pass around your request internally. It may take a while, but they do want to ensure you get a conclusive answer.

Geko is right – and @Jim, the documentation guy, has already published some major updates to the Docs, with various corrections, specs, and better guidelines, etc. … but he’s very new to ST (a couple months at most, I think?) – more detail, accuracy, and clarity will come with time. Was the section-link Geko referred you to helpful?

Jim is an example of an ST staffer you can directly tag here; but, remember, he’s just learning this stuff too, albeit at a “full-time” pace!

Good-luck! And don’t hesitate to ask us for help.
…Terry.


(Ron) #6

I was looking for a more detailed api. Like the documentation here
http://docs.smartthings.com/en/latest/reference-material.html

I agree it’s somewhat unfair to say it’s undocumented based on what your provided however I still have no idea what options are available or how they behave from this documentation so I don’t think it’s that unfair to say it is not WELL documented.

So I will take your advice and ping Jim.

@Jim if you have the time to reply to my questions I would appreciate it. The page that @geko provided didn’t really provide me with any information I didn’t figure out by looking at one sample of valueTile. What we really need, in my opinion, is an API.

standard is pretty well documented here
https://graph.api.smartthings.com/ide/doc/deviceType

Adding valueTile and controllTile to this page would be VERY helpful. Especially if the interdependencies are included such as adding an icon to a valueTile makes the value not display.

Thanks guys. Sorry if I seem negative, I don’t intend to, I just want to see this stuff improve. I feel honest feedback, direct questions, and suggestions can help make this happen.


(Mike M.) #7

Oh, I think it’s fair (though hyperbolic) to say it’s undocumented, considering that I’ve been finding posts where people were asking the same questions a year or two ago that I have now. Hopefully, a new technical writer means this will be addressed. It’s not like we have an IDE with autocomplete to help us out, or a debugger where we can inspect objects, and reflection is out, so what we have left is documentation and each other. Peer support is awesome, but it shouldn’t be required to outline the core structural stuff.

Do you know what I found today in my skimming through Device Type templates, looking for examples? carouselTile, plotTile, and chartTile. These types may or may not exist (it looks like a few sketchy templates are mixed in), but given that none of the tiles are well documented, who knows?

Blah, mumble, rawr, get off my lawn!