Mushroom couleur icone selon l'état

Salut @sebr

Là t’es sur une carte « tile », carte que Piitaya a intégré « officiellement » à HA bien après avoir créé « Mushroom » et après avoir rejoint la team « Nabu Casa ». Et on ne peut pas y appliquer de template.

Pour modifier les couleurs tu as 2 solutions :

1- Jouer avec card-mod, sur cette carte.
2- Prendre les cartes « mushroom » depuis HACS.

Avec les cartes « mushroom » d’hacs tu pourras le faire avec « mushroom-template-card », le + de cette carte c’est que tu peux personnaliser vraiment à fond. Et proprement, puisqu’elle est prévue pour ça :stuck_out_tongue:

Cas N°1 :

type: tile
entity: binary_sensor.mvt_escalier
card_mod:
  style: |
    ha-card {     
      {% if is_state('binary_sensor.mvt_escalier','on') %}
      --tile-color: red !important;
      {% else %}
      --tile-color: lawngreen !important;
      {% endif %}      
    }

image

Cas N°2 :

type: custom:mushroom-template-card
entity: binary_sensor.mvt_escalier
primary: Escalier
secondary: |
  {% if is_state(config.entity,'on') %}
    Détecté
  {% else %}
    Ras
  {% endif %}
icon: |
  {% if is_state(config.entity,'on') %}
    mdi:motion-sensor
  {% else %}
    mdi:motion-sensor-off
  {% endif %}
icon_color: |
  {% if is_state(config.entity,'on') %}
    deep-orange
  {% else %}
    cyan
  {% endif %}        
fill_container: true
tap_action:
  action: more-info
card_mod:
  style: |
    :host {
      --mush-icon-size: 48px;
    }
    mushroom-shape-icon {
      --shape-color: transparent !important;
    }
    ha-card {
      background: transparent;
      box-shadow: none;
    }

image

Voilà à toi de faire ton choix :wink: