Faut supprimer la partie changement de couleur et d’icone.
Exemple a partir de ton code. Juste avec ce code, ton entité aura une icone et couleur différent suivant son état.
Avant:
type: entities
title: PISCINE
icon: mdi:pool
show_header_toggle: false
entities:
- type: divider
- entity: switch.volet_piscine
name: Volet
show_icon: false
icon: mdi:window-shutter
style:
hui-generic-entity-row:
$: |
state-badge {
color: green;
{% set state=states('switch.volet_piscine') %}
{% if state=='on' %}
color: red;
icon: mdi:window-shutter-open
{% endif %}
}
card_mod:
style: |
ha-card > h1 > div {
color: black;
}
ha-card {
--ha-card-background: rgba(200,190,190,0.5);
}
Après:
type: entities
title: PISCINE
icon: mdi:pool
show_header_toggle: false
entities:
- type: divider
- entity: switch.volet_piscine
show_icon: true
card_mod:
style: |
ha-card > h1 > div {
color: black;
}
ha-card {
--ha-card-background: rgba(200,190,190,0.5);
}
car tu a ce code dans customize:
switch.volet_piscine:
friendly_name: Volet Piscine
templates:
icon_color: "if (state === 'on') return '#ff0000'; else return '#00b300';"
icon: "if (state === 'on') return 'mdi:window-shutter-open'; else return 'mdi:window-shutter';"