Using a template to show as a title/name in a picture-entity card

So I would like to have the output of this template to show as the title/name of a picture-entity card.
{{ states("sensor.discogs_random_record") }} / {{ state_attr("sensor.discogs_random_record","label") }} ({{ state_attr("sensor.discogs_random_record","cat_no") }}), {{ state_attr("sensor.discogs_random_record","released") }}

Output:
Elkie Brooks - The Rising Cost Of Love / Elk Edits (EBXDJ001), 2018

I tried to place the template in configuration.yaml as the name of a generic camera (which I use in a picture-entity card to show a random image of a record from the Discogs sensor), and also tried to change the name of the card in `ui-lovelace.yaml’.

None of them work. Could use some help, thanks.

You gotta use a custom template card in combination with the picture-entity card. There are a few custom templating cards. Do you have HACS installed?

Found a workaround that does the job…

Created another sensor:

      discogs_random:
        entity_id: sensor.discogs_random_record
        value_template: >
          {{ states("sensor.discogs_random_record") }} / {{ state_attr("sensor.discogs_random_record","label") }} ({{ state_attr("sensor.discogs_random_record","cat_no") }}), {{ state_attr("sensor.discogs_random_record","released") }}
        friendly_name: Discogs Random Record

Using this in ui-lovelace.yaml:

        - type: picture-entity
          entity: sensor.discogs_random
          camera_image: camera.random_discogs_record
          show_name: false
          show_state: true

Results in this:

1 Like

sorry, newbie here

Can you explain to me where you put the code for the sensor ? is it in configuration.yaml ?
, and I see the code below for ui-lovelace.yaml … where is that file located ? (cant find it)

Also, how do you call it on a card ? what card type to show the image ?

Thanks

configuration.yaml, it’s a template sensor.

His code here shows you exactly what card he’s using.

picture-entity card. The image is coming from his camera entity.