Mushroom Cards - Build a beautiful dashboard easily πŸ„ (Part 1)

Just add your if/on to the --icon-animation like this:

type: custom:vertical-stack-in-card
mode: vertical
fill_container: true
cards:
  - type: custom:vertical-stack-in-card
    horizontal: true
    cards:
      - type: custom:mushroom-template-card
        entity: switch.cctv
        layout: vertical
        icon: |-
          {% if is_state(entity, 'on') %}
            mdi:cctv
          {% else %}
            mdi:cctv-off
          {% endif %}
        icon_color: |-
          {% if is_state(entity, 'on') %}
            yellow
          {% else %}
            #6f6f6f
          {% endif %}
        card_mod:
          style:
            mushroom-shape-icon$: |
              ha-icon {
                {% if is_state(config.entity, 'on') %}
                  --icon-animation: scan 5s ease-in-out infinite;
                {% endif %}
                transform-origin: 90% 80%
              }
              @keyframes scan {
                0%, 100% { transform: rotate(20deg); }
                50% { transform: rotate(-15deg); }
              }
1 Like