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

[Bug]: Icon Color on state doesn't work #1539

Closed
3 tasks done
paunsurfer opened this issue Sep 16, 2024 · 4 comments
Closed
3 tasks done

[Bug]: Icon Color on state doesn't work #1539

paunsurfer opened this issue Sep 16, 2024 · 4 comments
Labels
question Further information is requested

Comments

@paunsurfer
Copy link

paunsurfer commented Sep 16, 2024

Requirements

  • I checked the troubleshooting section in the README to verify that I have the latest Mushroom version.
  • I did a search to see if there is a similar issue or if a pull request is open.
  • I have read the state of card mod support (in pin issues) and understand card mod support is not provided in this repository.

Current Behavior

I am attempting to have a chip change the icon color based on the state of an entity (in this case a person's home or away status), but for some reason can't get it to function. I've tried the following:

But the icon does not change color based on state, Am I missing something?

Expected Behavior

The icon should be green when person.jordan state = home

Steps To Reproduce

see post

Context

YAML state

chips:
  - type: spacer
  - type: entity
    entity: person.jordan
    content_info: name
    icon_color: |-
      {% if is_state('person.jordan', 'home') %}
        green
      {% else %}
        white
      {% endif %}

Environment

- Browser: Chrome
- HA Version: 2024.8.3
- Mushroom: 4.0.7

Anything else?

No response

@paunsurfer paunsurfer added the bug Something isn't working label Sep 16, 2024
@paunsurfer
Copy link
Author

Update:

Simply setting an icon color actually results in the desired behavior and the icon and color become state sensitive. (I still think the yaml i used should have worked though)

working:

``type: custom:mushroom-chips-card
chips:

  • type: spacer
  • type: entity
    entity: person.jordan
    icon_color: green
    content_info: name``

@swa72
Copy link

swa72 commented Sep 17, 2024

Nope, I observe the same on 2024.9.2.

type: horizontal-stack
cards:
  - type: custom:mushroom-entity-card
    entity: person.garden
    name: Garten
    tap_action:
      action: navigate
      navigation_path: /lovelace/garten
    icon: mdi:flower
    primary_info: name
    secondary_info: none
    icon_color: green

@paunsurfer
Copy link
Author

Yes, in the particular case of a presence detection the state based icon color seems to be built in, but the IF statements aren't working for me at all in mushroom cards. I'm finding i have to use 2 sets of cards, a helper toggle and an automation or two to replace the functionality:

i.e.:
{5223E63B-C0ED-4B2C-9B94-C87B89D4F591}
to result in state based functionality for template cards:
{40352EE4-0346-4A04-91BA-B183CF27F31E}

@piitaya
Copy link
Owner

piitaya commented Sep 18, 2024

Template are only available in the template card and the template chip.

@piitaya piitaya added question Further information is requested and removed bug Something isn't working labels Sep 18, 2024
@piitaya piitaya closed this as not planned Won't fix, can't repro, duplicate, stale Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants