Hello all, i have an entity climate with this attribute
hvac_modes: off, auto, heat
min_temp: 5
max_temp: 25
target_temp_step: 0.5
preset_modes: away, home, auto
current_temperature: 15.3
temperature: 15
current_humidity: 60.4
hvac_action: idle
preset_mode: home
offset_celsius: 0
offset_fahrenheit: 0
default_overlay_type: TADO_MODE
default_overlay_seconds: null
friendly_name: Hall D Entrée
supported_features: 401
I try to modify an icon based on this attibute : hvac_action: idle
here the code i try to use
chips:
- type: template
entity: climate.hall_d_entree
icon: >-
{% if is_state(state_attr('climate.anais', 'hvac_action')
, 'heating') %}
mdi:fire
{% elif is_state(state_attr('climate.anais',
'hvac_action'), 'IDLE') %}
mdi:moon-waning-crescent
{% else %}
mdi:heating-coil
{% endif %}
Try this format for attributes {% if state_attr(config.entity, 'hvac_action') == 'heating' %}
Thank for your help. I have this for the moment with your change but it doesn’t work ?
chips:
- type: template
entity: climate.anais
icon: >-
{% if state_attr(config.entity, 'hvac_action') == 'heating' %}}
mdi:fire
{% if state_attr(config.entity, 'hvac_action') == 'idle' %}
mdi:moon-waning-crescent
{% else %}
mdi:heating-coil
{% endif %}
icon_color: |-
{% if state_attr(config.entity, 'hvac_action') == 'heating' %}}
red
{% if state_attr(config.entity, 'hvac_action') == 'idle' %}
blue
{% else %}
grey
{% endif %}
Second conditions need elif
chips:
- type: template
entity: climate.anais
icon: >-
{% if state_attr(config.entity, 'hvac_action') == 'heating' %}
mdi:fire
{% elif state_attr(config.entity, 'hvac_action') == 'idle' %}
mdi:moon-waning-crescent
{% else %}
mdi:heating-coil
{% endif %}
icon_color: |-
{% if state_attr(config.entity, 'hvac_action') == 'heating' %}
red
{% elif state_attr(config.entity, 'hvac_action') == 'idle' %}
blue
{% else %}
grey
{% endif %}
and you had double }}
here my last code
type: custom:mushroom-chips-card
chips:
- type: template
entity: climate.anais
icon: >-
{% if state_attr(config.entity, 'hvac_action') == 'heating' %}
mdi:fire
{% elif state_attr(config.entity, 'hvac_action') == 'idle' %}
mdi:moon-waning-crescent
{% else %} mdi:heating-coil {% endif %}
icon_color: |-
{% if state_attr(config.entity, 'hvac_action') == 'heating' %}
red
{% elif state_attr(config.entity, 'hvac_action') == 'idle' %}
blue
{% else %} grey {% endif %}
type: custom:mushroom-chips-card
chips:
- type: template
entity: climate.anais
icon: >-
{% if state_attr(config.entity, 'hvac_action') == 'heating' %}
mdi:fire
{% elif state_attr(config.entity, 'hvac_action') == 'idle' %}
mdi:moon-waning-crescent
{% else %} mdi:heating-coil {% endif %}
icon_color: |-
{% if state_attr(config.entity, 'hvac_action') == 'heating' %}
red
{% elif state_attr(config.entity, 'hvac_action') == 'idle' %}
blue
{% else %} grey {% endif %}
icon_color: was indented
yes and the
icon: >-
{% if state_attr(config.entity, ‘hvac_action’) == ‘heating’ %}
mdi:fire
need to be
icon: |-
{% if state_attr(config.entity, ‘hvac_action’) == ‘heating’ %}
mdi:fire
Even if you enter >- it will change to |-
Are you good?
>
Folded Style
|
Literal Style
Yes it’s work now thank you for your help 