How to change tile background color based off of data event parameter

devicetype
tile

(Jakeholland) #1

I am having trouble finding a way to change the background color of a multiAttributeTile in respect to a color chosen. When calling a event. I am able to add the necessary hex color code as follows:

sendEvent(name: "switchColor", value: device.currentValue("colorName"), data:getSwitchColorMap(), displayed:false))

private Map getSwitchColorMap(){
	Map switchColorMap =  [
    	color:device.currentValue("color"), 
        mode:device.currentValue("colorMode"), 
        name:device.currentValue("colorName"),
        level:device.currentValue("level")
    ]
    return switchColorMap
}

But the attributeState that runs as result does not seem to be consuming the data parameter. Here is what I have for the attributeState:

attributeState "on", label:'${currentValue}', action:"switch.off", icon: "st.lights.philips.hue-single", backgroundColor:'${data."color"]', nextState:"turningOff"

I have also tried using backgroundColors as well, but to no avail… Not sure where to go from here, documentation in this area seems to be sparse.


(Matt Pennig) #2

Jake,

Unfortunately, what you’re attempting (data-driven background color) isn’t currently supported—either on standard/value tiles or multi-attribute tiles.

Also, while technically possible, passing keys to sendEvent beyond what is found here is undocumented behavior.


(Jakeholland) #3

Dang, so the only way is to make a bunch of attributeStates for each color? :frowning2: Are there any plans to add such functionality.


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

SmartThings has lots of “planned” improvements, including HTML5 support for DTHs, I believe.

The problem is that good intentions are worthless.

The functionality will exist whenever it happens to be released, and even then it will likely underwhelm and be buggy. Just setting low expectations to help ensure future happy surprises and fewer disappointments.


(Matt Pennig) #5

I’m not aware of any plans for data-driven background colors. And, with a nod to @tgauchat, I’m reluctant to make any promises. So I’ll simply acknowledge that what you’re asking for would be helpful, is something I’ve found myself wanting, and is a clear way we could improve the platform. Thanks for asking about it!


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

Congrats on joining SmartThings and welcome to the Community, Matt!

Forgive my lack of tact in some of my posts here… I’ve just been around long enough (3 years…) to yet see evidence of consistent delivery of improvements… Or more accurately the new challenges just slightly outpace the fixes, I think.

There will be a turning point in the race, though; I have to be sure to be open to seeing it. Thanks for your input.