un exemple :
type: tile
features_position: bottom
entity: sensor.lumieres_allumees
name: Lumières ON
card_mod:
style: |
ha-card {
{% if states(config.entity)|int(0) > 0 %}
--card-mod-icon: mdi:lightbulb-on;
{% else %}
--card-mod-icon: mdi:lightbulb-off;
{% endif %}
}
mais un groupe de lumière c’est on/off, le code serait comme telle :
type: tile
features_position: bottom
entity: sensor.lumieres_allumees
name: Lumières ON
card_mod:
style: |
ha-card {
{% if states(config.entity) == 'on' %}
--card-mod-icon: mdi:lightbulb-on;
{% else %}
--card-mod-icon: mdi:lightbulb-off;
{% endif %}
}
Pour la couleur de l’icone:
type: tile
features_position: bottom
entity: sensor.count_lumieres_rdc
name: Lumières ON
vertical: false
card_mod:
style: |
ha-card {
{% if states(config.entity)|int(0) > 0 %}
--card-mod-icon: mdi:lightbulb-on;
--tile-color: yellow !important;
{% else %}
--card-mod-icon: mdi:lightbulb-off;
--tile-color: grey !important;
{% endif %}
}