Markdown card with template won't format correctly

That is not, I tried and the same thing comes out, the literal text, it seems as if I was not able to interpret the template

<font color={% set long =states('binary_sensor.rclone_comando_longitud')%}{% if long == 'on' %}"white"{% else %}"red"{% endif %}>```[[ sensor.rclone_comando_limpio_lovelace ]]```</font>

Neither does it work :pensive:

your second part is using the [[ ]] brackets, while it should be using the {{ }} jinja template brackets

see:

      <font color = {{state_attr('sensor.family_home','icon_color')}} > - {{state_attr('sensor.home_badge','desc')}} </font>

in your case, replace the

```[[ sensor.rclone_comando_limpio_lovelace ]]```

with

{{states('sensor.rclone_comando_limpio_lovelace')}}

That doesn’t work either

<font color={% set long =states('binary_sensor.rclone_comando_longitud')%}{% if long == 'on' %}"white"{% else %}"red"{% endif %}>```{{ states('sensor.rclone_comando_limpio_lovelace') }}```</font>

Not even that

<font color={%'white' if is_state('binary_sensor.rclone_comando_longitud','on') else 'red'%}>

```[[ sensor.rclone_comando_limpio_lovelace ]]```</font>

please be more precise about what this means. error in the log?

btw, you didn’t use my previous template, but kept your old. don’t use the square brackets, and don’t use the back ticks.

<font color = {{'white' if is_state('binary_sensor.rclone_comando_longitud','on') else 'red'}} >{{states('sensor.rclone_comando_limpio_lovelace')}} </font>

There is no error in the registry, I am trying to change the text color of a markdown card according to the status of a binary sensor, but I always get the literal text if I try.

- type: markdown
  title: 'Comando Rclone'
  content: |

    <font color={{'white' if is_state('binary_sensor.rclone_comando_longitud','on') else 'red'}}>{{states('sensor.rclone_comando_limpio_lovelace')}}</font>

rclone2

try this one first to see if the markdown is working as it should:

  - type: markdown
    title: 'Sun'
    content: |

      <font color= {{'white' if is_state('binary_sensor.sun_up','on') else 'red'}}> Sun is {{states('sun.sun')}}</font>

shows:
42

second, test what

{{states('sensor.rclone_comando_limpio_lovelace')}}

does in the template editor, to see if the template itself is correct

The first test of the sun goes wrong, it shows the literal text.

The second goes well, gives the full command ok

This shows the text correctly in red

- type: markdown
  title: 'Comando Rclone'
  content: |

    <font color="red">```[[ sensor.rclone_comando_limpio_lovelace ]]```</font>

how odd the full Sun markdown card I gave you doesn’t work as it should. It does here :wink:

to proof to you it should, Ive changed it to:


  - type: markdown
    title: 'Sun'
    content: |

      <font color= {{'green' if is_state('binary_sensor.sun_up','off') else 'red'}}> Sun is {{states('sun.sun')}}</font>

showing:

14

maybe try another exact copy-paste?

and show us what it does. (even if the binary_sensor.sun_up doesn’t not exist. this should work)

same

rclone3

I’m going to try a clean homeassistant installation

Edit:

In a clean and empty homeassistant installation it shows well, I am in version 0.100.0b3

I will update to see if it is fixed.

This was my problem:

- url: /community_plugin/lovelace-markdown-mod/markdown-mod.js
  type: js

After deleting it already works fine.

Thanks @Mariusthvdb @petro