Custom Card Mod

Hi, Any idea why this isnt working? I’ve tried plenty of itterations but cant get it to work. I’ve searched an cant find an answer. I’m just trying to get the icon to change colour when ‘stove_enabled’ boolean in on, then back to white when off

Thanks in advance

    type: glance
    entities:
      - entity: sensor.stove_sensors_stove_flow_2
        card_mod:
          style: |
            :host {
              --card-mod-icon: mdi:thermometer-chevron-up; 
              --card-mod-icon-color: {% if states ('input_boolean.stove_enabled', "on") -%} indianred 
                                     {% elif states ('input_boolean.stove_enabled', "off") -%} white
                                     {% else %} white
                                     {% endif %};

Wrong jinja templates.
Use dev tools → template to check/fix

And do not create separate threads for similar issues, this clutters the Community.
There is a dedicated card-mod thread.

Very helpful thanks…

You are trying to use advanced technics (card-mod) w/o knowing basic templating.

  1. Templating
  2. Check templates in Dev tools → Templates.
    It should be
is_state('input_boolean.stove_enabled', 'on')

Thank you. I am learning the basics of templating which is why I ask the community. Everyone has to learn somehow. Thank you for your assitance on this.

You are welcome.

  1. Any questions regarding templating in general (not only related to card-mod) could be asked here: Configuration
  2. There is a list of examples of using card-mod which might be useful for you. Go to the huge card-mod thread → 1st post → link at the bottom. These examples will not cover all your needs but might give you a direction. Particular questions regarding using card-mod it is better to ask in that thread.
  3. In general, every popular custom card has own dedicated thread in this " Dashboards & Frontend" section.