I am struggling today with displaying a value I store in an attribute so that it shows up in the tile label independently from my state value that I use to select tile state to display as they have different weather icons I extract from a weather service.
This even is also well fired as the right icon is displayed in my Tile.
But the tile displays “null” as label.
I checked about the usage of attributes in tiles and understood the concatenation of the current state with the attribute name, but it seems the value is not returned.
Any idea?
Thanks!
tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
2
This same question just came up a week ago, but darned if I remember the Topic title to search for it … nor even the conclusive answer.
If I recall correctly, though, I/we concluded that a “standardTile” cannot display an arbitrary Attribute Value. It can only display currentValue or name.
Keep in mind that the “definition” section of a DTH is not “real” Groovy code. It is handled by a pre-processor with specific “sandbox” limitations.
With that said s better way is to limit the user to a list of choices. For example here is a modified contact sensor for used with the konnected system which gives a lot more options for open and closed :
Thanks for your usual quick answer. I indeed tried everything I read in the documentation pages and other posts but they are always having a tie between the state and the label. I didn’t find an example of something with a state and a label.
Using the label: '${name}", as my attribute is named “weather”, I modified my “string” attribute into an enum as the weather forecasts are finally a big set of predefined value, it could work :
attribute “weather”, “enum”, [“Smoke”]
If I understand well this code, it allows the overload of the labels because this is based on a Multi-Tile and split in 2 messages the state sent to the primary control and the value to the tile hosting the primary tile states.
But in my case, I use standardTile as I have many:
Ok, I’ll go for simpler solution then. I spit my tile in 2 tiles. One for the icon, one for the string.
That’s not what I wanted, but it looks to be anyway over the ST offer in term of UI.
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
8
Yep that’s correct. It’s a limitation going back years where we had this discussion about dynamic tiles. But those are the only options now. The workaround is to create attributes with dynamic values and then use the currentValue for that attribute in the tile.
That one won’t work for me as my tile is a multi-state because of the icons I have to manage. I would have enjoyed to dynamically provide the icon name instead of having one state for one icon, but I guess for the same reasons we are discussing here on the label, there is no dynamic icon management either. So I had to stick to the multi-state, originally with labels that I removed since I split the label in another tile to solve my initial problem.
Correct, that’s how I implemented it first. I am using UndergroundWeather API here.
I originally used the ‘icon’ string in their json as a state so that it was showing both the right icon and string, both hardly coded. Everything worked fine till last week. I am California and I got “flurries” for the weather instead of “smoke” because the ‘icon’ turned into “Smoke” and this wasn’t an icon name (hazy is the icon they use for that string).
So I should not use the ‘icon’ string as a ‘weather’ string, I have to get both of them from their json.
So I changed my implementation to use the ‘icon’ name and then needed something to pass the weather string in the same StandardTile.