Picture Elements - conditional image based on App name from Apple TV

Hi,

I try to show the right image based on the App name from my Apple TV. It shows the App Name as an attribute but I don’t know how to implement it into the code. In this case “YouTube”.

Bildschirmfoto 2024-05-06 um 15.31.43

          - type: conditional
            conditions:
              - entity: media_player.apple_tv
                attribute: app_name
            elements:
              - type: image
                action: none
                tap_action: none
                hold_action: none
                image: /local/floorplan/ipad_wohnzimmer_tv_youtube.png
                style:
                  top: 50%
                  left: 50%
                  width: 100%

Thanks for your help.

I’d rather go away from conditional card and switch to custom template card, that allows you to create templates for normally not templatable configuration items. I’m doing this with several cards in my config, to show in picture elemnts card custom background based on some entities state or attribute. Here is an example, quick and dirty, hope will work for you:

type: picture-elements
image: /local/background.png
elements:
  - type: custom:config-template-card
    entities:
      - media_player.apple_tv
    variables:
      - states['media_player.apple_tv'].attributes.app_name
    element:
      type: image
      image: ${'/local/' + vars[0] + '.png'}
    style:
      top: 50%
      left: 50%
      width: 100%

Then, obvioulsy, for each app name you need to have corresponding image.png in config/www folder.

Thanks. I will try it.