lovelace-template-entity-row icon indicating copy to clipboard operation
lovelace-template-entity-row copied to clipboard

Colors of icons changing with recent versions

Open martkopecky opened this issue 1 year ago • 16 comments

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

martkopecky avatar Feb 22 '24 07:02 martkopecky

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.

ildar170975 avatar Feb 23 '24 00:02 ildar170975

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...

martkopecky avatar Feb 23 '24 09:02 martkopecky

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.

thomasloven avatar Feb 23 '24 10:02 thomasloven

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

Mariusthvdb avatar Mar 11 '24 12:03 Mariusthvdb

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

This was broken in 2024.3.

ildar170975 avatar Mar 11 '24 14:03 ildar170975

Seems there is something more:

image

chemelli74 avatar Mar 13 '24 21:03 chemelli74

@chemelli74 yes, same issue

ildar170975 avatar Mar 13 '24 21:03 ildar170975

@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 ?

chemelli74 avatar Mar 13 '24 23:03 chemelli74

Is there any solution to this problem?

ganjakyp-hub avatar May 31 '24 09:05 ganjakyp-hub

getting back to this, because after testing 2024.7.beta, IO 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?

Mariusthvdb avatar Jun 27 '24 14:06 Mariusthvdb

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

image

image

ildar170975 avatar Jun 27 '24 14:06 ildar170975

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

Mariusthvdb avatar Jun 27 '24 15:06 Mariusthvdb

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 avatar Jun 27 '24 15:06 ildar170975

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

ildar170975 avatar Jun 27 '24 15:06 ildar170975

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!

maximuswallis avatar Jun 30 '24 13:06 maximuswallis