Mushroom template ändern

Mal eine Frage an die Mushroom Experten. Ich hab dieses Template, möchte aber nun vor der Prozentanzeige den Text „Raus“ bei > 10% und „Zu“ bei < 10& haben. Wie kann man das bewerkstelligen?

type: custom:mushroom-template-card
primary: |2
Markise
secondary: „{{ 100 - (state_attr(‚cover.markise‘, ‚current_position‘)) }} %“
icon: mdi:window-closed
icon_color: blue
tap_action:
action: none
hold_action:
action: none
double_tap_action:
action: none
entity: sensor.markise_rev
fill_container: false
card_mod:
style: |
ha-card {
background-color: transparent ;
}
ha-card {
box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.66) !important;
}

1 „Gefällt mir“

Leider hat er mir die Formatierung der yaml zerdeppert. Gibts eine Möglichkeit das hier korrekt darzustellen?

1 „Gefällt mir“

Moin clajo,

du kannst es mal wie folgt probieren:

type: custom:mushroom-template-card
primary: |2
  Markise
secondary: >
  {% if 100 - (state_attr('cover.markise', 'current_position')) > 10 %}
    Raus {{ 100 - (state_attr('cover.markise', 'current_position')) }} %
  {% else %}
    Zu {{ 100 - (state_attr('cover.markise', 'current_position')) }} %
  {% endif %}
icon: mdi:window-closed
icon_color: blue
tap_action:
  action: none
hold_action:
  action: none
double_tap_action:
  action: none
entity: sensor.markise_rev
fill_container: false
card_mod:
  style: |
    ha-card {
      background-color: transparent;
    }
    ha-card {
      box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.66) !important;
    }

Code kannst du am besten posten indem du:
A) ``` schreibst, dann den Code und dann nochmal das gleiche (kann ich jetzt nicht, weil es sonst ja zu Code werden würde
B) Indem du vorher oben in der Leiste überm Textfeld wo auch Fett, Kursiv und Co ist dieses Symbol anklickst </> und dann deinen Code an der makierten Stelle einfügst.

Liebe Grüße!

3 „Gefällt mir“

Vielen Dank,

hat perfekt geklappt.

2 „Gefällt mir“