Custom:button-card (or jinja2/javascript) new line?

Hi everybody,

I am trying to display two lines underneath a custom:button-card card in lovelace. This is the code

        name: |
          [[[
            return "Vorne: " + (states['climate.wohnzimmer_vorne_heizung_climate'].attributes.current_temperature) + "°0C \n"
            + "Strasse: " + (states['climate.wohnzimmer_strasse_heizung_climate'].attributes.current_temperature) + "°C"
          ]]]

I have tried > instead of | (as I always get confused with the meaning of these symbols), but there was no difference. I also tried without the \n and having a regular line break in my editor (currently it is one regular line without break), but also no difference.

The card looks like this

grafik

I don’t necessarily need the second entity, but it’d be nice to display both. Is that possible with this card?

Thank you in advance for your help :slight_smile:

You can use the label. Something like this:

        name: |
          [[[
            return "Vorne: " + (states['climate.wohnzimmer_vorne_heizung_climate'].attributes.current_temperature) + "°0C"
          ]]]
        label: |
          [[[
            return "Strasse: " + (states['climate.wohnzimmer_strasse_heizung_climate'].attributes.current_temperature) + "°C"
          ]]]

In the card definition, you have to include the line:

  show_label: true
1 Like

Thank you. Using the label works perfectly.