Dynamic image URL

A media player has the entity_picture attribute.
The URL is to a file in the api folder.

If I template the URL like this:{{ states.media_player.nya_plattan.attributes.entity_picture }}

Then I open the browser and go to the resulting link, as an example:

Then I get the image, Great!

If I now add the template as picture element card, picture entity card or picture card the image is not shown.
Is there anything I can do to get the dynamic URL in a picture card (preferably picture elements card but any picture card will do)?

1 Like

Picture elements doesn’t seem to support templates in its URL field. Take a look at lovelace card templater in HACS though. Its a custom card that can wrap any other card and basically just add template support to all of its fields. I’ve never tried it with picture-elements but I use it a lot for other types of cards and it works well.

1 Like

Thank you!

I can’t get it to work now, but I’ll have a look this weekend and see if I can figure it out.

you can use a Generic Camera with an image of the path you gave. Then show the camera image in the picture elements or picture card.

1 Like

That worked!

It needs some more work but now I can see the tablet screen.

I tried to add a generic camera in my configuration yaml but got an error that it is being depreciated. Do you have an idea of how to get this functionality without this?

Is that not because it is now fully done in the GUI?
So no longer in the yaml file but using the frontend.

Thanks for the response, I wasn’t aware that the URL could be templated like that

Ended up going a round about way where I use node red to download the image into HA then use a local_file camera instead.