thomasloven / lovelace-template-entity-row

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

1.3.2: the "active" option doesn't changes icon color when the "entity" option indicated #107

Closed ech0-py closed 4 months ago

ech0-py commented 1 year ago

The "entity" option is required when you wanna use actions, but it seems entity's icon color takes precedence over "active" icon The state_color: true/false of entities card changes nothing

issue_1 issue_2

type: entities
entities:
  - type: custom:template-entity-row
    entity: automation.heating_night_tariff
    icon: mdi:home-automation
    name: Automation
    state: '{{ states("automation.heating_night_tariff") }}'
    active: '{{ is_state("automation.heating_night_tariff", "on") }}'
    tap_action: none
    hold_action:
      action: more-info
    double_tap_action:
      action: call-service
      service: automation.trigger
      data:
        entity_id: automation.heating_night_tariff
        skip_condition: true

Browser: Chrome 111.0.5563.148 (or hass companion app, android) Hass: 2023.4.2 template-entity-row: 1.3.2 (HACS install)

ech0-py commented 1 year ago

The workaround will be adding the color option like color: '{{ is_state("automation.heating_night_tariff", "on") | iif("yellow") }}'

RoboMagus commented 1 year ago

Thanks for that workaround @ech0-py that works great. Sticking to the theme that might be configured differently for any user I'd advise using instead something in the lines of: color: '{{ is_state("automation.heating_night_tariff", "on") | iif("var(--state-active-color)") }}'.

I hope to see this issue propperly fixed though.

tomkessler commented 6 months ago

I'm noticing this behavior as well. However, "active" seems to be automatically recognized for entities in the "light" domain; I don't even need to specify a template for active; the icon changes color as expected. However, for a fan it seems not to recognize the state or the template for "active". The color workaround above does work but it would be great if the state would automatically be recognized for all domains.