Card-mod style works, but shows a %7D%7D error

Tags: #<Tag:0x00007f73905580b0>

since 113 (or is it card-mod 2…) my background of a card which has this for style template:

type: custom:dark-sky-weather-card
style: |
 ha-card {
   background: url("/local/images/weather-background-{{states('sun.sun')}}.png");
   background-size: 100% 400px;
   }

it shows fine. However, Inspector throws this error

https://mydomain.duckdns.org:port/local/images/weather-background-%7B%7Bstates('sun.sun')%7D%7D.png

why could this be? Has something changed in the card-mod logic maybe?

Basically it means that instead of trying to fetch the weather-background-above_horizon.png it’s fetching weather-background-{{states('sun.sun')}}.png. So really it’s “Templating not being applied”

yes, I guess so.
But, HA does load the correct background image… So the error is incorrect.

Probably a preview error. Do you know where the error is coming from? In Chrome, it shows a link on the right.

well, it’s the exact same thing:

Can you click on the link? It should show you the location.

yes, I can, and that yields:

while I fact, the folder contains these:

Schermafbeelding 2020-08-02 om 23.34.50

and has been like this for over 2 years… (or so)

If you right-click the list item that doesn’t exist, can you show the source?

no sure what you’re after tbh. All I get is the same path with the %7D. in it, which of course doesnt exist and give a 404 error

Huh…
Anyway, at this point, I’d recommend filing an issue over at card-mod’s GitHub, because if it works, then really the only bug is that you have unnecessary stuff in your log.

This is because the unprocessed string is used first, and then replaced with the template result once it returns from the backend.
The error can be safely ignored so long as it works, and when it doesn’t, this will help you find the problem.

thanks Thomas. Does this mean we keep seeing errors on jinja templates from now on in the inspector? Or would you be able to prevent this (seeing this is new behavior, and didnt show before on card tools 1)
Would be really nice if you could somehow manage that. Or, of course, have us use other techniques templates maybe, that are a preferred method.