Custom Card Mod - Change Icon & Colour on State

Hi Guys

I’m really struggling with this one… I want to change the icon and colour based on a state of input boolean.

If I can get this working i can figure it out…

{{ if states ('input_boolean.stove_enabled', "on"), ('sensor.flue_sensor_stove_flue_temp' |float <= 190) }: mdi:thermometer-minus;}
{% endif %}}

Any tips?

Thanks in advance

I should proabably explain better… I only want the icon to be a certain colour and icon type when the input booleon is on. When its off I just want it to be white

Thanks

Suggest to discuss card-mod in the dedicated thread.

Not sure… its more to do with template rather than card mod. I’m in developer tools trying different things. It should return the state regardless of card mod

Have you tried

{% if ... %}
color: red;
{% else %}
color: green;
{% endif %}

As for changing an icon itself by card-mod - try setting a “–card-mod-icon” variable similarly (but this may not work in some cases).

Fixed it… needed the ‘and’. I don’t think I explained myself very well in the origional post. The template didnt bring back what I expected as it was looking for a float from the input boolean. I needed the ‘and’ inbetween the input boolean and sensor

Thanks for assisting though… I’m slowly getting there with templates

{% if is_state ('input_boolean.stove_enabled', "on") and states ('sensor.flue_sensor_stove_flue_temp') |float <= 190 %}

Suggest to use it as “is_state(” & “states(” to avoid errors.