Hey,
Why wont this code work together, please? When i remove the style portion the icon changes, if i remove the :host portion, the color changes fine, together only the icon change works.
type: entities
entities:
- entity: input_number.brightnessfirebl
icon: mdi:account-group
card_mod:
style: |
ha-card {
background-color:
{% set vol = states('input_number.brightnessfirebl') | int %}
{% if vol == 1 %} pink
{% elif vol == 2 %} yellow
{% elif vol == 3 %} green
{% elif vol == 4 %} red
{% endif %};
}
:host {
--card-mod-icon:
{% set vol = states('input_number.brightnessfirebl')|float(0) %}
{% if vol == 1 %} mdi:volume-off
{% elif vol <= 2 %} mdi:volume-low
{% elif vol <= 3 %} mdi:volume-medium
{% else %} mdi:volume-high
{% endif %};
}