How to make state_color: true global?

With 0.105 none of my switches show the color any more. I knew this was coming in the changelog but didn’t realize I would have to touch every entity/card to revert the behavior. I want the old functionality back globally, is there a way to do this? I can’t easily tell anymore what’s on and off - in-fact I don’t even fully understand why this change was made in the first place. I have a crap-ton of entities like the coffee pot that was great to see it lit up when it was on.

7 Likes

Although I haven’t tried this but you should be able to edit customize_glob.yaml

and add …

"switch.*":
    state_color: true

this would target all switches. You can create additional blocks like that for all domains that you need.
Let me know if that works.

A better question is, can we set custom color for on states?

I’ve given this a go and it doesn’t appear to work… Unless i’ve doing something wrong…

This is the content of my customize_glob.yaml

"switch.*":
  state_color: true

When I upgrade to a future version isn’t this going to be overwritten?

I tried as well and agree with @danmed - doesn’t seem to work.

No, updates don’t touch your config.

I was confused by the name of the file. So this the customize yaml which its name might be different and it is included in the configuration.yaml, correct?

You can either put it in the configuration.yaml directly, or split it off into separate files.

Eitehr way, updating HA doesn’t touch your configuration files. be it config or customisation.

I really don’t think that will work. The state_color option is applied to an entities card or an entities card row. You can’t apply it to the entity directly.

1 Like

Agreed, I have tried adding state_color to certain entities in the customize file and to the switch domain in the customize_domain file but it doesn’t work. State_color only seems to work when added at the card level.

As @eggman said, you can’t configure this on entity level.

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.