Mushroom Template Card, if-statement for choosing entity?

Hello Community!!!

I’m using the a mushroom template card to make a dashboard of icons of my 3D printers and states of printing… but there is one column in my dashboard that is a count down clock of remaining printer time. When the printer is off, it just displays zero which is boring so I just want that whole “cell” be nothing. I tried to use a condition card based on printer being off, but it shifts all my icons over weirdly and doesn’t line up with the rows and the printer on. So I was thinking of setting the entity with an if-else statement… if the printer is on and running show timer entity, if off, use a null entity. Then at least it keeps the placeholder and all my icons stay in line.

Unfortunately I cannot figure out the correct syntax for the if-else in the entity field.

Here is what I have for that portion of my code:

      - type: custom:mushroom-entity-card
        entity: |
          {% if is_state('sensor.a1_03919d540803836_print_status', 'running') %}
            sensor.a1_03919d540803836_remaining_time
          {% else %}
            null
          {% endif %}
        card_mod:
          style:
            mushroom-shape-icon$: |
              .shape {
                --icon-symbol-size: 0px;
                --icon-size: 0px;
              }
            mushroom-state-info$: |
              .container {
               --card-primary-font-size: 0px;
               --card-secondary-font-size: 14px;
                flex-direction: row !important;
                align-items: baseline;
              }
            .: |
              ha-card {
               border: 2.0px outset orange;
               background-color: transparent;
                width: 100px;
              }

Its the top right orange boarder that I’m trying to get this to work on :frowning:

The Mushroom Entity card does not allow templating.

Ah… ok. Can I if-else the border color under the ha-card? Or anywhere in the entity card its not allowed? Thanks!

There is no such thing, even if you did use a Mushroom Template Card. The configuration variable entity is not templatable based on Mushroom’s docs:

You would need to template the primary value so that it returns something other than the state.