Mushroom template card is killing me!

Hi team! I have been struggling to make a mushroom template card do what I want. I feel like I am doing it correctly but apparently not! Could someone steer me in the right direction? Would love any help!

I want an icon (mdi:silverware-clean) to appear only when “sensor.diswasher_time_remaining” is not equal to 4:00. This sensor reports the amount of time left on the dishwasher. 4:00 is the default time when the dishwasher is not running. My code is below. But it is ALWAYS displaying the icon. Like right now, my sensor.dishwasher_time_remaining is 4:00, and the icon is still showing. What am I doing wrong??

              - type: custom:mushroom-template-card
                primary: ""
                secondary: ""
                icon: mdi:silverware-clean
                show_icon: |-
                  {% if states("sensor.dishwasher_time_remaining") != '4:00' %}
                    true
                  {% else %}
                    false
                  {% endif %}
                icon_color: >-
                  {% if is_state("binary_sensor.kitchen_dishwasher_clean",
                  'off') %}
                    blue
                  {% elif is_state("binary_sensor.kitchen_dishwasher_clean",
                  'on') %}
                    green
                  {% else %}
                    grey
                  {% endif %}

I am not using mushrooms & have no idea about this particular “show_icon” option.
May be this

{% if states("sensor.dishwasher_time_remaining") != '4:00' %}

is wrong.
Please post a screenshot from Dev tools → State for this entity.
It probably has a “device_class: duration” and thus should be processed differently.

Thanks! Does this help?

Yes. And you are using “sensor.dishwasher_time_remaining”, why ? )))

Sorry, I noticed the typo and fixed that. But no dice :frowning:

Erm, post again that corrected code then (for me, for posterity, for mushroom-addicted-users)

        - type: custom:mushroom-template-card
                primary: ""
                secondary: ""
                icon: mdi:silverware-clean
                show_icon: >-
                  {% if states("sensor.kitchen_dishwasher_time_remaining") !=
                  '4:00' %}
                    true
                  {% else %}
                    false
                  {% endif %}
                icon_color: >-
                  {% if is_state("binary_sensor.kitchen_dishwasher_clean",
                  'off') %}
                    blue
                  {% elif is_state("binary_sensor.kitchen_dishwasher_clean",
                  'on') %}
                    green
                  {% else %}
                    grey
                  {% endif %}

Is it a proper Docs page?
Cannot find that “show_icon” option.

Ugh!! I got that from chatGPT. I was trying to get it to help me since I saw some other folks recommend it. I just got it working by doing the below. I appreciate your help!!!

                icon: >-
                  {% if states("sensor.kitchen_dishwasher_time_remaining") != '4:00' %}
                    mdi:silverware-clean
                  {% else %}
                    ""
                  {% endif %}

Grrrrr, hate these AIs.

I think I do too. I was trying to help myself before asking on here… and it just ends up adding to my confusion!

One more good lesson for humans. Suggest you to mark your solution post as a “solution”.
(and probably RENAME your thread)

On it. Thank you for your help!!

1 Like