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

Color Icon when state is off on Mushroom entity card #20

Closed
stianmt opened this issue May 12, 2022 · 2 comments
Closed

Color Icon when state is off on Mushroom entity card #20

stianmt opened this issue May 12, 2022 · 2 comments
Labels
question Further information is requested

Comments

@stianmt
Copy link

stianmt commented May 12, 2022

Hi

I tried to add a color template to change the color on the entity card. But seems like it is not possible to add color to an icon when state is off.

I have a few magnet sensors on my windows, and it would be great if I could set the color of the icon to green when they are closed (State is off but set to closed since entity has device class "opening" which sets state off to closed (https://www.home-assistant.io/integrations/binary_sensor/))

Is it possible to add the opportunity for color template like it is for the icon template?

@piitaya
Copy link
Owner

piitaya commented May 12, 2022

You can do this with the template-card. All fields are templates

@juliandsp91
Copy link

juliandsp91 commented May 20, 2022

In case somebody needs, here is an example of icon color template:

This sets the color based on entity state:

icon_color: |
  {% if is_state('switch.lavadora_power_off', 'off') %}
    grey
  {% else %}
    blue
  {% endif %}

This sets the color based on entity attribute "current":

icon_color: |
  {% if state_attr('script.activa_secuencia_dormir', 'current') == 1%}
    blue
  {% else %}
    grey
  {% endif %}

Only need to change the entities name, states and colors.

@piitaya piitaya added the question Further information is requested label Nov 6, 2022
@piitaya piitaya closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2022
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