Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown card not working in a Popup card #681

Open
4 tasks done
LDprg opened this issue Feb 11, 2024 · 2 comments
Open
4 tasks done

Markdown card not working in a Popup card #681

LDprg opened this issue Feb 11, 2024 · 2 comments

Comments

@LDprg
Copy link

LDprg commented Feb 11, 2024

My Home Assistant version: 2024.2.1

What I am doing:
Adding a Markdown card to a popup card causes it to be empty. Static text and Templates wont work.

What I expected to happen:
The markdown card to work as expected like everywhere else.

What happened instead:
Well no visible markdown card/content.

Minimal steps to reproduce:

  1. create a popup card
  2. add a markdown card with some content
  3. open the popup card

Error messages from the browser console:

Nothing special here.


By replacing the space in the checkboxes ([ ]) with an X below, I indicate that I:

  • Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).

  • Have made sure I am using the latest version of the plugin.

  • Have followed the troubleshooting steps of the "Common Problems" section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.

  • Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.

@MEKadan
Copy link

MEKadan commented Feb 12, 2024

This is a mod of a pop-up card I have. Includes some sample sensors and also markdown.

For me it works

show_name: true
show_icon: true
type: button
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      title: Tank heater contactor control
      content:
        type: vertical-stack
        cards:
          - type: entities
            title: Title 1
            show_header_toggle: false
            theme: my_theme
            entities:
              - entity: sensor.sensor_1
                name: Name for sensor 1
                secondary_info: last-updated
              - entity: sensor.sensor_2
                name: Name for sensor 2
                secondary_info: last-updated
          - type: markdown
            title: My markdown name
            content: >-
              Your markdown text goes here
              Your markdown text goes here
              Your markdown text goes here                           
       
name: Name for the card
show_state: true
icon: mdi:something
icon_height: 40px

@xbmcnut
Copy link

xbmcnut commented May 5, 2024

@LDprg I was having an issue recently where content in my markdown card would be blank when executed from a script in a pop-up. If I ran the script manually, the pop-up would appear and the markdown would be displayed. Drove me nuts for several days and when the automation ran (to launch the pop-up service), all I got was this:

image

I found a closed bug here that mentioned wrapping the markdown in {% raw %} and {% endraw %} and that worked!
N.B It was working without the raw wrapping until a recent Home Assistant update sometime in April I think so don't know what changed.

  - type: conditional
    conditions:
      - condition: numeric_state
        entity: sensor.flightradar24_current_in_area
        above: 0
    card:
      type: markdown
      content: >-
        {% raw %} {% set data =
        state_attr('sensor.flightradar24_current_in_area', 'flights') %} {% for
        flight in data %}
          <ha-icon icon="mdi:airplane"></ha-icon>{{ flight.flight_number }}({{ flight.aircraft_registration }}) - {{ flight.airline_short }} - {{ flight.aircraft_model }}
          {{ flight.airport_origin_city }}{%if flight.airport_origin_city %}<img src="https://flagsapi.com/{{ flight.airport_origin_country_code }}/shiny/16.png" title='{{ flight.airport_origin_country_name }}'/>{% endif %} -> {{ flight.airport_destination_city }}{%
          if flight.airport_destination_country_code %}<img src="https://flagsapi.com/{{ flight.airport_destination_country_code }}/shiny/16.png" title='{{ flight.airport_destination_country_name }}'/>{% endif %}
          {%if flight.time_scheduled_departure %}Departure - {{ flight.time_scheduled_departure | timestamp_custom('%H:%M') }}; {% endif %}{%if flight.time_scheduled_arrival%}Arrival - {{ flight.time_scheduled_arrival | timestamp_custom('%H:%M') }}{% endif %}
          Altitude - {{ flight.altitude }} ft{%if flight.altitude > 0 %} ({{(flight.altitude * 0.3048)| round(0)}} m){% endif%}; Gr. speed - {{ flight.ground_speed }} kts{%if flight.ground_speed > 0 %} ({{(flight.ground_speed * 1.852)| round(0)}} km/h){% endif%}
          {% endfor %}
          {% endraw %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants