Changing text colour for bulb state


#1

I have a set of tiles setup for all my bulbs, I have been able to change the background colour of the tile depending on if the bulb is on or off, but I cant seem to get the text to do the same, I want it to be black when its on and white when it is off.

This is what I am using to try and accomplish that (IsBulbOn ? ‘#000000’ : ‘#FFFFFF’)

Here is the full piston https://imgur.com/a/GYc27


#2

Please upload your piston to this site, don’t use imgur… apart from the possibility of the link breaking in the future, it’s blurry and I can’t make it out.


#3

Apologies, please see below…


#4

I don’t think the ternary operator works like that… needs to be allong the lines of:

(something == something ? true : false)

As you are setting the variable (ISBulbOn) with an expression and then immediately using it… why not merge the two into one and dont bother saving the variable at all?

(([$currentEventDevice : switch]) == ‘on’ ? ‘#000000’ : ‘#FFFFFF’)


#5

Thanks,

I’ll give that a go and see if it works


#6

Unfortunately that didn’t work - Think I’ll just find two colours that work with white text