Option to invert icon_state coloring

Sometimes, when you are using an binary sensor, the Icon is showing as active in the state of “unclocked” - and inactive when the state is locked.

But in certain situations, you want to have it displayed in the opposite: Actve when the sensor is showing LOCKED and inactive, when it is unlocked.

It would be great, if you would have an option in the lovelace editor where you can easily configure if an icon state should be inverted or not.

Agree and adding on to this:
Additionally to the state colour, one step deeper, to be considered is the ON/OFF state as well. A lock that is ‘ON’, does it really make sense that this always means the lock is unlocked? In my opinion not.

1 Like

Another use case to add. I have screens on my patio, which I have as “covers” in HA. Covers are highlighted when they are “up”. I’d like to have the icon highlighted when the screens are “down”.

2 Likes

I have a command line binary sensor (connectivity class) checking the availability of some local service.
The icon is colored in “connected” state which is the “normal” state in my case.
I would like the icon color to catch my attention when the state is “disconnected”, meaning something is wrong with the service availability.

Sebastian

A related colour-related use case: I have voltage issues so I want to track when the voltage is outside the regulation limits. I’ve created a binary sensor to track this based on my voltage data that is “On” when the voltage is violating, and “Off” when the voltage is OK. This is fine…but, my weird on is that when I look at the history I want to invert the colours - at present green is used when then sensor is on, and red when it is off…but instinctively green = good and red = bad…but in my case it is the opposite… A feature to invert colours for icon and history would be great!

I started writing a new topic and this came up as most relevant. So no progress or HACS options yet?

Check how ridiculous this looks:

1 Like

I think, with the already implemented - and upcomming coloring features, this might actually increase it’s importance.

By default, there are defined settings for the colors of specific entities (security related, when is a door safe / unsafe?)

But - as we are all individuals, that means, that the new states might not be the same for all devices that we have.
Sometimes, a “locked” door can be ‘safe’ - in other cases, a “locked” state for some device should require our attention.

Therefore, it would be REALLY good to get that invert-option on top, or to allow to define what the OK or NOK state of an entity would be.

2 Likes

Oh yes! I would like this option as well. I have some states which I preferred to be the other way around. Shouldn’t be hard to implement :

state_color: true
state_color_inverse: true

Solved! (wishful thinking):wink:

3 Likes

This becomes more and more important to me :wink:

For a couple of days I have now a SurePet CatFlap installed.
The state for the lock is now shown in my default configuration:

  state-lock-jammed-color: var(--red-color) #'#F44336' # Red
  state-lock-locked-color: var(--green-color) #'#4CAF50' # Green
  state-lock-pending-color: '#FF9800' # Orange
  state-lock-unlocked-color: var(--red-color) #'#F44336' # Red

This is working as expected for my cars, where the “good” state is LOCKED (doors and charging-cable)
grafik

But for the Cat flap, the default and good state should be unlocked…
grafik

So, these should be green by default - and only red, when they are locked, because then, this needs to have my attention.

Again, I need to ‘workaround’ with Card Mod to modify the state colors, rather than just having an option to invert the default state colors… :frowning:

1 Like

[update]
while inverting the color state of an entity / card is possible with card-mod, this does not apply for the “more info” page of the entity.

Therefore, a ‘real’ invert option would be really benefitial.
To add more value to the FR, I’ve randomly collected the topics about “invert xyz” here from the forum:

1 Like