I’m trying to make a popup card that displays weather alert data. I can create a markdown card and use templates to add the information I want, however when I use the same configuration as a popup, it just displays the template code, instead of the data.
Here’s the configuration that works as a plain markdown card.
type: markdown
content: >-
<b>What:</b> {{
state_attr('sensor.natrona_county_lower_elevations','alerts')[0].NWSheadline
}}
<b>Area:</b> {{
state_attr('sensor.natrona_county_lower_elevations','alerts')[0].area }}
<b>Certainty:</b> {{
state_attr('sensor.natrona_county_lower_elevations','alerts')[0].certainty }}
<b>Expires:</b> {{
state_attr('sensor.natrona_county_lower_elevations','alerts')[0].expires }}
title: Weather Alert
Which produces this card:
The code I use to make it a popup:
show_name: true
show_icon: true
type: button
tap_action:
action: call-service
service: browser_mod.popup
target: {}
data:
type: markdown
content: >
<b>What:</b> {{
state_attr('sensor.natrona_county_lower_elevations','alerts')[0].NWSheadline
}}
<b>Area:</b> {{
state_attr('sensor.natrona_county_lower_elevations','alerts')[0].area }}
<b>Certainty:</b> {{
state_attr('sensor.natrona_county_lower_elevations','alerts')[0].certainty
}}
<b>Expires:</b> {{
state_attr('sensor.natrona_county_lower_elevations','alerts')[0].expires
}}
deviceID:
- this
title: Alert Detail
dismissable: true
autoclose: false
entity: sensor.natrona_county_lower_elevations
The card pops up, but the templates are not interpreted and just printed as plain text.
Is there some reason templates don’t work in a pop-up? Am I missing something?
Thanks in advance.