thomasloven / lovelace-template-entity-row

🔹 Display whatever you want in an entities card row.
MIT License
210 stars 16 forks source link

HA 2022.12 color scheme not inherited, still using paper-item-icon-active-color #95

Closed Mariusthvdb closed 4 months ago

Mariusthvdb commented 1 year ago

As title, the template-entity-row can not be set to inherit the new color schemes, see below for an example using the new binary-color which colors blue when on https://github.com/home-assistant/frontend/blob/3c8c1260b172cb2ef01328070e1c900b2cd3d4dc/src/resources/ha-style.ts#L145

in this case the top entity (unmodded, only needs state_color: true) the bottom speaks for itself, the active is also set, but it takes

paper-item-icon-active-color: gold from the theme I set before the new color schemes were introduced.

  - type: entities
    state_color: true
    entities:
      - binary_sensor.ha_dev_update_available

      - type: custom:template-entity-row
        entity: binary_sensor.ha_dev_update_available
        name: >
          {% if states[config.entity] is not none %}
          {{state_attr(config.entity,'friendly_name').split(': Update Available')[0]}}
          {% else %} Initializing
          {% endif %}
        state: >
          {% if states[config.entity] is not none %}
            {{iif(states(config.entity) == 'on','Update available','Up to date')}}
          {% else %} Waiting for state
          {% endif %}
        secondary: >
          {% if states[config.entity] is not none %}
            {% set id = states[config.entity].object_id.split('_update_available')[0] %}
            {% if states['sensor.' + id + '_newest_version'] is not none %}
            New: {{states('sensor.' + id + '_newest_version')}} -
            {% endif %}Current:
            {{states('sensor.' + id + '_version')}}
          {% else %} Initializing
          {% endif %}
        active: >
          {{is_state(config.entity,'on')}}
Scherm­afbeelding 2022-12-09 om 16 09 51

taking out paper color from the theme, leaves us with:

Scherm­afbeelding 2022-12-09 om 16 14 27

even though the more info is correctly showing the blue:

Scherm­afbeelding 2022-12-09 om 16 15 18

to be 100% certain it isnt an issue with the config.entity var, I also tried

active: >
    {{is_state('binary_sensor.ha_dev_update_available','on')}}

lastly, when taking out the full t-e-r config, and only leaving the auto-entities section

  - type: custom:auto-entities
    card:
      type: entities
      title: Binaries update available
      card_mod:
        class: class-header-margin
      state_color: true
    show_empty: false
    filter:
      include:
        - entity_id: binary_sensor.*_update_available
          state: 'on'
#           options:
#             type: custom:template-entity-row
#             name: >
#               {% if states[config.entity] is not none %}
#               {{state_attr(config.entity,'friendly_name').split(': Update Available')[0]}}
#               {% else %} Initializing
#               {% endif %}
#             state: >
#               {% if states[config.entity] is not none %}
#                 {{iif(states(config.entity) == 'on','Update available','Up to date')}}
#               {% else %} Waiting for state
#               {% endif %}
#             secondary: >
#               {% if states[config.entity] is not none %}
#                 {% set id = states[config.entity].object_id.split('_update_available')[0] %}
#                 {% if states['sensor.' + id + '_newest_version'] is not none %}
#                 New: {{states('sensor.' + id + '_newest_version')}} -
#                 {% endif %}Current:
#                 {{states('sensor.' + id + '_version')}}
#               {% else %} Initializing
#               {% endif %}
#             active: >
#               {{is_state(config.entity,'on')}}

the blue is shown alright:

Scherm­afbeelding 2022-12-09 om 16 23 31

independent from the paper color. so it is the t-e-r preventing the inheritance of the new color scheme

btw, exchanging

#   paper-item-icon-color: var(--primary-color)
  state-icon-color: '#636B75'

doesnt make a difference, in this case the state-icon-color is used, and still not the supposed binary color