Skip to content

how to have multiple state colors? #1074

Discussion options

You must be logged in to vote

You had a part to much in your code.
It was hard to see/read because you did not use the code block

Use this

.bubble-icon {
  color: ${hass.states['lock.porta_fronte_bocchio_lock'].state === 'locked' ? 'lightred' : 'lightgreen'} !important;
}   
.bubble-sub-button-1 > ha-icon {
  color: 
    ${hass.states['sensor.porta_fronte_bocchio_batteria'].state < 10 ? 'red' :
     hass.states['sensor.porta_fronte_bocchio_batteria'].state <= 20 ? 'yellow' :
     'green'} !important;
} 


${icon.setAttribute("icon", hass.states['lock.porta_fronte_bocchio_lock'].state === 'locked' ? 'mdi:lock' : 'mdi:lock-open')}

If this solves your issue, please mark this as solved and close the discussion.

Replies: 4 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@platini76
Comment options

@MrBearPresident
Comment options

@platini76
Comment options

@platini76
Comment options

Answer selected by MrBearPresident
Comment options

You must be logged in to vote
2 replies
@platini76
Comment options

@MrBearPresident
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
3 participants
Converted from issue

This discussion was converted from issue #830 on December 22, 2024 12:52.