How to make state_color: true global?

So can you just at a global level make this behave like in previous versions? I’ve got easily 100 places I would need to touch to restore the previous behavior.

As far as I know, you can’t.

Well that’s pretty silly. :frowning: This change has kill the WAF in my house.

Looks like you’re going to have a long weekend :sweat_smile:

I mostly use templates to create the cards on the frontend, this way I only need to add this option to a few templates and I’m done. However I don’t need to add this at all, because all my templates already have a color configured for the icon based on the state of the entities used.

Yeah I am. :frowning: Now you have me intrigued though, I haven’t messed with templates nor was I aware how to configure icon based one the state of the entity. Can you elaborate please? This might be a good time to revamp my lovelace config.

I believe you’ll find lots of examples when you search the forum. One of the more interesting ones is here, where the goal was to have the color of the icon match the color of the light: Pull color state from light

Yeah you are right, the global file is for entities overides not lovelace. I didn’t think about that. Sorry about that :slight_smile:

Can someone give an example how to enable that for all the switches?

What you need to insert and where?

Apparently there is no global way.

That’s pretty cool but my lights already do that (Hue and z-wave). I’m more interested in the templating stuff.

But it says that you can enable switches or all types there is a way to do it

Add this to customize_glob

switch.*:
  templates:
    icon_color: >
      if (state === 'on') return 'var(--state-icon-active-color)';
      return icon_color;
2 Likes

You can use it per Lovelace card.

7 Likes

@Krocko - That didn’t work

@VGE - I know but I have a crap-ton of cards across maybe a dozen tabs. I’m looking for a GLOBAL way to change this back to the old behavior.

1 Like

Yea that sucks. Sorry cant help.

It is working. I use it.
Have you installed custom ui?

Custom UI? What’s that?

I know how to use it, but I’m not experienced enough with lovelace to give you a good explanation. Maybe @jimz011 (hope it’s ok that I tag you here) can give you a short explanation if he doesn’t mind.

@Burningstone, I could yes. @danodemano custom-ui is actually a modification meant for the states-ui (which is now deprecated btw). But it has some extra functionality regarding customization. By default Home Assistant does not support templating customized entities, with Custom-UI this is possible.

By default you can customize entities and give them another name, icon and/or device_class. But you can’t set an icon based on the state of the device. With custom-ui this is possible as well as having a colored icon based on the state (though this will only work with core cards and NOT with e.g. custom:button-card).

in my case I use the custom:button-card a lot and so color isn’t very useful for me, however I do use icons based on the state. For an example of how I use it click here and then click on “Personal Setup”.

You can find a lot of other useful examples there. I hope this will help you!

1 Like

The states UI is being removed in 0.107 (Or 0.108 - can’t recall) though right? So does that mean at that time custom-ui also goes away? I don’t want to start putting time into that if it’s just about to go away.