Is there any way I can change a tile’s color based on the value of a text variable?
@Danny_Richman, conditional color is not currently supported in text variable tile. Can you please describe the use case with a bit more details? Thank you.
Thanks James. Just thought of a workaround using a Virtual Switch
James, I am looking to do just what the op asked about, change tile color based on the value of a string variable. In my case a string variable coming over from Hubitat. In an effort to increase WAF I asked my wife, and daughters, what they would like to see on the dashboards. The number one request is color change tiles with status of things like the washer, dryer, dishwasher, security system etc. so they can see statuses at a glance from across the room. They want to have a large tile per appliance or system that shows a text status and changes color based on operating state.
Maybe like this:
It’s easy enough in Hubitat to generate Global Variables that state the status of the various appliances. And, I have now learned how to have those variables come across to SharpTools. The missing piece is how to alter a tiles color based on that variable. If they were simply on off states I could use a two state tile like a switch, but they are asking for more than simply on/off. Again, picking up the appliance state is a simple enough affair with a a few smart sensors on the appliance. But the tile text and color are what I’m not sure about.
Has this capability been looked at since the original post? Is there a tile type that would accommodate this, or maybe a way to use Rule Engine alter a tiles color?
There’s a feature request open for Color State Mapping for Custom Attributes that you might want to cast a vote on as I think it would directly cover what you’re looking for.
In the meantime, an alternative approach would be to use a custom driver like the one noted in the following thread:
Then in your rule, you could set the
text attribute to reflect the state and then flip the
switch on/off to indicate whether it should be active or not.
Edit: Note that the driver implements the Notify capability, so you can use that to set the text in Rule Machine without having to define a custom command for
Thanks! I added my vote to the feature request and I’m headed over to look at that customer driver post next.