Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colors of icons changing with recent versions #123

Open
martkopecky opened this issue Feb 22, 2024 · 16 comments
Open

Colors of icons changing with recent versions #123

martkopecky opened this issue Feb 22, 2024 · 16 comments

Comments

@martkopecky
Copy link

Not sure if this is a bug or a feature, but with one of the last plugin versions & update to HA 2024.02, the colors of the icon for template-entity-rows have started changing based on the underlying entity state. I've seen yellow/amber for toggle: on and also purple in some cases.

For now, it can be cured by specifying color: var(--paper-item-icon-color) explicitly.

I can see no such behavior on the automatically generated dashboard, so I expect that this whole color changing is not something new in the core components just being inherited to the template entity row.

Sorry for the vague description. Here an example of amber icon:

image

@ildar170975
Copy link

the colors of the icon for template-entity-rows have started changing based on the underlying entity state. I've seen yellow/amber for toggle: on and also purple in some cases.

This is normal & expected in Entities card with "state_color: true" defined.

@martkopecky
Copy link
Author

I have no such card defined in my dashboard, they either don't have the state_color attribute at all or they are set to false. Based on the docs, false is default.

So I think the root cause is somewhere else...

@thomasloven
Copy link
Owner

There was some buggy behaviour around this introduced in a recent version of Home Assistant. Work is currently ongoing to determine what is the right behavior, and then to fix it.

@Mariusthvdb
Copy link

Mariusthvdb commented Mar 11, 2024

not sure if this is the same, but template-entity-row does not follow state_color: true when doing

type: entities
state_color: true
entities:

  - type: custom:template-entity-row
    entity: sensor.slaapkamer_hygro_temp_battery
Scherm­afbeelding 2024-03-11 om 13 25 07

while its more-info does show the correct state_color:

Scherm­afbeelding 2024-03-11 om 13 25 17

we can set an explicit card_mod on it:

      - type: custom:template-entity-row
        entity: sensor.slaapkamer_hygro_temp_battery
        card_mod: !include /config/dashboard/card_mods/battery_color.yaml

which does:

Scherm­afbeelding 2024-03-11 om 13 28 12

currently testing with

Core
2024.4.0.dev20240311
Frontend
20240308.0.dev

@ildar170975
Copy link

this is the same, but template-entity-row does not follow state_color: true when doing

This was broken in 2024.3.

@chemelli74
Copy link

Seems there is something more:

image

@ildar170975
Copy link

@chemelli74 yes, same issue

@chemelli74
Copy link

@chemelli74 yes, same issue

Sorry, I may miss something but core itself shows green color (which is correct), while template row not.
Isn't it an issue on this custom card code ?

@ganjakyp-hub
Copy link

Is there any solution to this problem?

@Mariusthvdb
Copy link

Mariusthvdb commented Jun 27, 2024

getting back to this, because after testing 2024.7.beta, I now also see that the active options is not set when using below config, nor is the icon properly inherited from the entity, as the documentation explains/instructs:

      - type: custom:template-entity-row
        entity: device_tracker.private_ble_device_marijn
        active: >
          {{is_state(config.entity,'home')}}

should light up properly (it did before) and change to the connected icon:

this it the template entity row:

Scherm­afbeelding 2024-06-27 om 16 22 22

and yes, ive also set state_color: true in the containing entities card.

this is the correct more info:

Scherm­afbeelding 2024-06-27 om 16 22 29

coloring according to the theme colors, and setting the icon according to the device

could it be relatively new Icon translations are not yet supported and we need to explicitly template those now?

@ildar170975
Copy link

Imho active is not working for some long time.
For instance, in 2024.6.4 it does not work:

image

image

@Mariusthvdb
Copy link

thanks for confirming, I wasnt sure.

However, I am sure it did work when I created this card, and that was short after the private Ble were introduced, and a bit later when the state_translated was introduced.

dont believe the template-entity-row has the state_color: option though? (the bottom example of your post.)

anyways, I really hope this magic card will see an update sometime.

maybe I should open a separate issue for the icon (didnt check yet if there already is one), to keep it as clear and clean as possible to track

@ildar170975
Copy link

dont believe the template-entity-row has the state_color: option though? (the bottom example of your post.)

Added this example just in case.

@ildar170975
Copy link

According to my log, "active" was not working by "06.04.23".

@maximuswallis
Copy link

maximuswallis commented Jun 30, 2024

Hi,
A workaround to this problem is adding this to the entity:

color: |
  {% if is_state('switch.your_switch_here', 'on') %}
    var(--state-active-color)
  {% elif is_state('switch.your_switch_here', 'off') %}
    var(--state-inactive-color)
  {% else %}
    var(--disabled-color)
  {% endif %}

I hope this helps someone!

@arigit
Copy link

arigit commented Oct 12, 2024

still an issue as of 2024.10.2; thanks @maximuswallis for the workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants