🔹 Auto-entities - Automatically fill cards with entities

Hello everyone

I’m trying to put together a small gaming dashboard with Steam shortcuts. This works quite well with auto entities mushroom and card mod. But what I can’t quite manage are the automatic background images for the mushroom cards. if I set them statically, it works, but not dynamically.

With the mushroom image it works with the variable, but not with the background:

type: custom:auto-entities
filter:
  include:
    - entity_id: '*game_*'
      device: TEST
      name: '*Favorites*'
      options:
        type: custom:mushroom-template-card
        primary: ''
        secondary: ''
        picture: >-
          https://cdn.cloudflare.steamstatic.com/steam/apps/{% set str =
          state_attr(entity, 'friendly_name') %}{% set sub = str.split('_')[2]
          %}{{sub}}/header.jpg
        tap_action:
          action: toggle
        layout: vertical
        card_mod:
          style: |
            ha-card {     
             
                background-image: url('https://cdn.cloudflare.steamstatic.com/steam/apps/{% set str = state_attr(entity, 'friendly_name') %}{% set sub = str.split('_')[2]%}{{sub}}/header.jpg')!important;
               
                }
sort:
  method: friendly_name
card:
  square: false
  type: grid
  columns: 7
  title: Favorites
card_param: cards
show_empty: true
view_layout:
  position: main

2024-03-01 22_47_26-Gaming – Home Assistant

How could I solve this?