Skip to content

[Bug]: dynamic badges not being dynamic #104

@mentaluproar

Description

@mentaluproar

Requirements

  • I checked the README.
  • I have updated entity-progress-card to the latest available version.
  • I did a search to see if there is a similar issue.

Current Behavior

I’m trying to set a badge with will set icon/color to mdi:washing-machine/disabled when powered off, mdi:washing-machine-alert/red when in error state, and mdi:washing-machine/primary when running. There’s no icon shown when I make the icon and color conditional and the text stays white rather than the matching what the icon should be. I’m tying this into the LG thinq integration.

I have it set as follows:
type: heading
heading_style: title
heading: Basement
icon: mdi:home-floor-b
badges:

  • type: custom:entity-progress-badge
    entity: sensor.washing_machine_minutes_remaining
    icon: |-
    {% if states('sensor.washer_current_status') == 'power_off' %}
    mdi:washing-machine-off
    {% elif states('sensor.washer_current_status') != 'unknown' %}
    mdi:washing-machine-alert
    {% else %}
    mdi:washing-machine
    {% endif %}
    color: |-
    {% if states('sensor.washer_current_status') == 'power_off' %}
    disabled
    {% elif states('sensor.washer_current_status') != 'unknown' %}
    red
    {% else %}
    primary
    {% endif %}
    bar_color: primary
    bar_effect: shimmer
    frameless: true
    custom_info: |-
    {% if states('sensor.washer_current_status') == 'power_off' %}
    off
    {% else %}
    {{ states('sensor.washer_current_status') | capitalize }} - {{ states('sensor.washing_machine_minutes_remaining') }} mins
    {% endif %}
    min_value: 0
    tap_action:
    action: none
    hold_action:
    action: none
    double_tap_action:
    action: none
    hide:
    • name
    • progress_bar
    • value

Expected Behavior

No response

Steps To Reproduce

No response

Context

YAML state

Environment

- Browser:
- HA Version:
- Entity Progress Card:

Anything else?

No response

Metadata

Metadata

Labels

documentationImprovements or additions to documentation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions