Template Ninja2 in Mushroom card not working

I am puzzeling now for almost half a day but can’t get it working.

My code is:

                  - type: custom:mushroom-entity-card
                    entity: binary_sensor.roombaroomba_bin_full
                    layout: vertical
                    icon_color: red
                    primary_info: name
                    secondary_info: last-changed
                    name: >
                      {%- if is_state("binary_sensor.roombaroomba_bin_full", 'on') -%}
                        'Vol'
                      {%- else -%}
                        'Leeg'
                      {% endif %}   

No matter how I change hyphens, semicolons, brackets, greater than’s etc etc, it isn’t flying and gives me nothing else than this outcome in my dashboard:

Schermafbeelding 2023-04-23 om 15.57.38

Can anyone help me out?

Secondary question:

Is there any comprehensive explanation on >'s and -'s after the key declaration, like in this case after the name: part? I have seen also ‘1’ in certain examples but I have no clue what the do and when to use what and what it actualy says to the parser.

Use Mushroom template card

tried the mushroom template card already?

type: custom:mushroom-template-card
primary: |-
  {% if is_state('binary_sensor.roombaroomba_bin_full', 'on') %}
  Vol
  {% else %}
  Leeg
  {% endif %}
icon: mdi:robot-vacuum
layout: vertical
entity: binary_sensor.roombaroomba_bin_full
icon_color: |-
  {% if is_state('binary_sensor.roombaroomba_bin_full', 'on') %}
  red
  {% else %}
  green
  {% endif %}   
secondary: ''

For HA templating use they are pretty much interchangeable.

As @vingerha and @Mats789 have posted, the main issue is with your card type selection, not your template. Though, you should not mix ' and " inside parentheses… that can lead to lots of frustration.

Yes, you are right :+1: