On 1 (and only 1) card in my config, I found the new(ish) markdown-code-background-color
to be used, alongside another default font.
for testing purposes, I explicitly set it to red:
and without it set at all (so using default HA values) is looks like:
all of my other Marddown cards show without that formatting, eg:
or
as far as I can see/understand the configs are identical, an entities card with a markdown card using a template:
type: entities
title: Hue & Trädfri batteries
card_mod:
class: class-header-margin
entities:
- type: custom:hui-element
card_type: markdown
card_mod:
style: |
ha-card.type-markdown {
margin: -8px -16px;
box-shadow: none;
}
content: >
Batteries below threshold:
{% set batteries = expand(integration_entities('Ikea Trådfri'),integration_entities('hue'))
|rejectattr('state','in',['unavailable','unknown'])
|selectattr('attributes.device_class','eq','battery') %}
{% set alert_level = states('input_number.battery_alert_level')|int(default=0) %}
{% for b in expand(batteries)
if b.state|int(default=0) < alert_level %}
{{b.name}}: {{b.state}} %
{% endfor %}
and:
type: entities
title: Hue light groups
card_mod:
class: class-header-no-margin
entities:
- type: custom:hui-element
card_type: markdown
card_mod:
style: |
ha-card.type-markdown {
box-shadow: none;
margin-top: 8px;
overflow-y: scroll;
height: 300px;
}
content: |
{% set group_list = states.light
|selectattr('attributes.is_hue_group','eq',true)|map(attribute='entity_id')|list%}
{%- for g in group_list -%}
{% set ns2 = namespace(lights=[]) %}
{%- for name in state_attr(g,'lights') -%}
{%- for l in states.light
if l.attributes['friendly_name'] == name %}
{% set ns2.lights = ns2.lights + [l.entity_id] %}
{% endfor %}
{% endfor %}
**{{state_attr(g,'friendly_name')}}** (*{{states(g)}}*):
{%- for l in ns2.lights %}
> {{state_attr(l,'friendly_name')}}: *{{states(l)}}* since {{as_timestamp(states[l].last_changed,none)|timestamp_custom('%H:%M:%S %d %b',default=none)}}
{%- endfor %}
{% endfor %}
or:
type: entities
title: Hue devices connectivity
card_mod:
class: class-header-margin
entities:
- type: custom:hui-element
card_type: markdown
card_mod:
style: |
ha-card.type-markdown {
margin: -8px -16px;
box-shadow: none;
}
content: >
Hue devices with connectivity issue:
{% set hue = expand(integration_entities('hue')) %}
{% for b in expand(hue) if b.state == 'connectivity_issue' %}
> {{b.name.split(': Zigbee Connectivity')[0]}}
{% endfor %}
would really appreciate if anyone could see why this would happen on this 1 and only card, or phrased differently, why the HA defaults aren’t set on all other cards…
thanks!
edit
btw, and still dont understand the WHY, but this:
content: >
Batteries below threshold:
{% set batteries = expand(integration_entities('Ikea Trådfri'),integration_entities('hue'))
|rejectattr('state','in',['unavailable','unknown'])
|selectattr('attributes.device_class','eq','battery') %}
{% set alert_level = states('input_number.battery_alert_level')|int(default=0) %}
>{%- for b in expand(batteries)
if b.state|int(default=0) < alert_level %}
{{- b.name}}: {{b.state}} %
{% endfor %}
or maybe cleaner:
content: >
Batteries below threshold:
{% set batteries = expand(integration_entities('Ikea Trådfri'),integration_entities('hue'))
|rejectattr('state','in',['unavailable','unknown'])
|selectattr('attributes.device_class','eq','battery') %}
{% set alert_level = states('input_number.battery_alert_level')|int(default=0) %}
{%- for b in expand(batteries)
if b.state|int(default=0) < alert_level %}
> {{- b.name}}: {{b.state}} %
{% endfor %}
makes it show as
where the 2 {%-
were enough to stop the markdown formatting. The >
is a simple Markdown code for tab.
how odd…