Skip to content

Need help re on/off state coloring #512

Closed Answered by Clooos
willliamchan asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can also change the color based on an attribute this way, by replacing hass.states['fan.your_entity'].state === 'state 1' with hass.states['fan.your_entity'].attributes.your_attribute === 'attribute state'.

But I will cover all of this in the new documentation, I still have a lot of work to do on that point. I really want to make everything clear and easy to understand.

Edit: You made a mistake, it's like this:

.bubble-button-card-container {
  background: ${hass.states['fan.your_entity'].state === 'state 1' ? 'color if state 1' :
  hass.states['fan.your_entity'].state === 'state 2' ? 'color if state 2' : 
  hass.states['fan.your_entity'].state === 'state 3' ? 'color if state 3' : '

Replies: 3 comments 13 replies

Comment options

You must be logged in to vote
7 replies
@willliamchan
Comment options

@Clooos
Comment options

@willliamchan
Comment options

@Clooos
Comment options

Answer selected by willliamchan
@willliamchan
Comment options

Comment options

You must be logged in to vote
6 replies
@willliamchan
Comment options

@Clooos
Comment options

@willliamchan
Comment options

@Clooos
Comment options

@willliamchan
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants