Use variable to set color 2

Hi

I am actually creating this to reopen this one (h697686)as it is closed bu I had no time to reply

Hi

I have different cards to show entities graphs on different dashboards.
I would like to minimize the effort when I want to change the color of an specific entities.
My plan is to use variables somehow.

I started with HACS Var integration, but even the variable has the proper value, it does not works:

And also defining a string helper:

  • if it works, line should be pink, not black

Anyone did something similar? There is any HACS integration I can use?

@123 respond it should be a request to minigraph card, but i checked, and it also does not work on HA standard cards, i.e gauge:


but it shows pink if I add color directly:

NOTE: sorry if I miss anything, but why initial item was closed? i had not time to respond, as I had no access to the computer during the weeknd…

thanks

It was closed because you were asking for an enhancement to a third party card. Feature requests are for core development only. If you want an enhancement to a third party resource then contact the developer of that resource on github.

Also most core cards do not support templates. If they do they will say so in the card documentation, Dashboards - Home Assistant

Do not open a new request asking for template support for core cards if one already exists or it will be closed as a duplicate. Please read the pinned FR guidelines. Feature Request Guidelines đź“”

1 Like

Hi

I did not know why it was closed, only response it had was about to ask for a third party card, but I had same issue on standard cards (but I had not even chance to include this info)

With your last details, it also explains about standard cards, but again, this was not explained on initial post, this is why I opened a new one.

Thanks

Where in Home Assistant’s documentation do you see an example of a template used in a card?

The answer is nowhere except for the Markdown card. That’s the only native card that (currently) supports templates. None of the other cards do.

That’s how the documentation works for all of Home Assistant’s features (not just cards). If it doesn’t explicitly indicate support for templates and/or there are no examples showing the use of templates then templates are not supported.

No, I did not see, and in fact I also did not know it has to specifically be mentioned, sorry to ask things in a forum.

Normally, when technical documentation doesn’t explicitly mention something, it’s not an oversight but an indication that it’s not supported.

If you need to define options dynamically - start learning these custom cards:

  • config-template-card (a “wrapper” for a card which allows to use templates);
  • auto-entities (by using a “template” filter you can make any inner card “templatable”);
  • button-card (place any card as a “custom field” and use JS-based templates);
  • and css-stuff like colors may be set by card-mod templates.
1 Like