Using variables with browser_mod to create pop_up media_player remotes

Hi all,
I am relatively new home assistant and could use some help/advice on how to create pop up remotes for media players, using variables…if that is possible. Or if someone has a better approach i am all ears.

Basically i have a 3 cards that use the mini media player. All of which are Apple TVs

media cards

For the Master Bedroom card, I am using browser_mod to replace the “more info” with a grid card that has another mini media card that uses the shortcuts/buttons for my favorite apps as well as custom button cards that uses call services for remote.send_commands.

For the master bedroom, it works exacly as i would like. I want to be able to do this for the other 2 apples tvs. If i copy and paste the code 3 times (and just change the entity to the other apple_tvs) it will work. But i was kind of hoping there was better/cleaner way to accomplish this. In case i change something, i’d rather not have to change it 3 times. Maybe using a variable to pass the different entities (media_player.apple_tv_master_bedroom, media_player.apple_tv_master_kitchen, media_player.apple_tv_master_kitchen). I am using the Raw Config editor to add the popup_cards.

i have used variables within a script/button combo. So am a little familiar with using them in HA, but just not sure how (if at all) to do it in this scenario.

here is YAML

views:
  - theme: Mushroom
    title: TV
    icon: mdi:television
    popup_cards:
      media_player.apple_tv_master_bedroom:
        title: Master Bedroom Remote
        card:
          type: grid
          square: false
          columns: 1
          cards:
            - type: custom:mini-media-player
              name: Master Bedroom
              entity: media_player.apple_tv_master_bedroom
              volume_stateless: false
              group: false
              hide:
                power: true
                source: true
                name: true
                play_pause: true
                prev: true
                next: true
                volume: true
                info: true
                icon: true
                progress: true
              shortcuts:
                hide_when_off: false
                attribute: source
                columns: 6
                column_height: 30
                buttons:
                  - image: /local/logos/remote/disney.png
                    type: source
                    id: Disney+
                  - image: /local/logos/remote/plex.jpeg
                    type: source
                    id: Plex
                  - image: /local/logos/remote/happy_kids.png
                    type: source
                    id: HappyKids.tv
                  - image: /local/logos/remote/youtube.jpeg
                    type: source
                    id: YouTube
                  - image: /local/logos/remote/espn.jpeg
                    type: source
                    id: ESPN
                  - image: /local/logos/remote/nbc_sports.png
                    type: source
                    id: NBC sports
            - square: false
              columns: 3
              type: grid
              cards:
                - type: custom:button-card
                  entity: media_player.apple_tv_master_bedroom
                  icon: mdi:power
                  show_name: false
                  show_state: false
                  size: 10%
                  styles:
                    icon:
                      - color: green
                      - width: 40px
                      - height: 40px
                    card:
                      - border: 0%
                      - margin: 0px
                      - background-image: url('/local/logos/remote/button_background.png')
                      - background-size: cover
                      - background-repeat: no-repeat
                      - height: 50px
                    name:
                      - justify-self: middle
                      - font-weight: null
                      - font-size: 15px
                      - padding-top: 10px
                  tap_action:
                    action: call-service
                    haptic: medium
                    service: media_player.turn_on
                    service_data:
                      entity_id: media_player.apple_tv_master_bedroom
                - type: custom:button-card
                  entity: media_player.apple_tv_master_bedroom
                  icon: mdi:arrow-up-bold
                  show_name: false
                  show_state: false
                  size: 10%
                  styles:
                    icon:
                      - color: white
                      - width: 40px
                      - height: 40px
                    card:
                      - border: 0%
                      - margin: 0px
                      - background-image: url('/local/logos/remote/button_background.png')
                      - background-size: cover
                      - background-repeat: no-repeat
                      - height: 50px
                    name:
                      - justify-self: middle
                      - font-weight: null
                      - font-size: 15px
                      - padding-top: 10px
                  tap_action:
                    action: call-service
                    haptic: medium
                    service: remote.send_command
                    service_data:
                      command: up
                      entity_id: remote.apple_tv_master_bedroom
                - type: custom:button-card
                  entity: media_player.apple_tv_master_bedroom
                  icon: mdi:power
                  show_name: false
                  show_state: false
                  size: 10%
                  styles:
                    icon:
                      - color: red
                      - width: 40px
                      - height: 40px
                    card:
                      - border: 0%
                      - margin: 0px
                      - background-image: url('/local/logos/remote/button_background.png')
                      - background-size: cover
                      - background-repeat: no-repeat
                      - height: 50px
                    name:
                      - justify-self: middle
                      - font-weight: null
                      - font-size: 15px
                      - padding-top: 10px
                  tap_action:
                    action: call-service
                    haptic: medium
                    service: media_player.turn_off
                    service_data:
                      entity_id: media_player.apple_tv_master_bedroom
            - square: false
              columns: 3
              type: grid
              cards:
                - type: custom:button-card
                  entity: media_player.apple_tv_master_bedroom
                  icon: mdi:arrow-left-bold
                  show_name: false
                  show_state: false
                  size: 10%
                  styles:
                    icon:
                      - color: white
                      - width: 40px
                      - height: 40px
                    card:
                      - border: 0%
                      - margin: 0px
                      - background-image: url('/local/logos/remote/button_background.png')
                      - background-size: cover
                      - background-repeat: no-repeat
                      - height: 50px
                    name:
                      - justify-self: middle
                      - font-weight: null
                      - font-size: 15px
                      - padding-top: 10px
                  tap_action:
                    action: call-service
                    haptic: medium
                    service: remote.send_command
                    service_data:
                      command: left
                      entity_id: remote.apple_tv_master_bedroom
                - type: custom:button-card
                  entity: media_player.apple_tv_master_bedroom
                  icon: mdi:power-off
                  show_name: false
                  show_state: false
                  size: 10%
                  styles:
                    icon:
                      - color: white
                      - width: 40px
                      - height: 40px
                    card:
                      - border: 0%
                      - margin: 0px
                      - background-image: url('/local/logos/remote/button_background.png')
                      - background-size: cover
                      - background-repeat: no-repeat
                      - height: 50px
                    name:
                      - justify-self: middle
                      - font-weight: null
                      - font-size: 15px
                      - padding-top: 10px
                  tap_action:
                    action: call-service
                    haptic: medium
                    service: remote.send_command
                    service_data:
                      command: select
                      entity_id: remote.apple_tv_master_bedroom
                - type: custom:button-card
                  entity: media_player.apple_tv_master_bedroom
                  icon: mdi:arrow-right-bold
                  show_name: false
                  show_state: false
                  size: 10%
                  styles:
                    icon:
                      - color: white
                      - width: 40px
                      - height: 40px
                    card:
                      - border: 0%
                      - margin: 0px
                      - background-image: url('/local/logos/remote/button_background.png')
                      - background-size: cover
                      - background-repeat: no-repeat
                      - height: 50px
                    name:
                      - justify-self: middle
                      - font-weight: null
                      - font-size: 15px
                      - padding-top: 10px
                  tap_action:
                    action: call-service
                    haptic: medium
                    service: remote.send_command
                    service_data:
                      command: right
                      entity_id: remote.apple_tv_master_bedroom
            - square: false
              columns: 3
              type: grid
              cards:
                - type: custom:button-card
                  entity: media_player.apple_tv_master_bedroom
                  icon: mdi:menu
                  show_name: false
                  show_state: false
                  size: 10%
                  styles:
                    icon:
                      - color: white
                      - width: 40px
                      - height: 40px
                    card:
                      - border: 0%
                      - margin: 0px
                      - background-image: url('/local/logos/remote/button_background.png')
                      - background-size: cover
                      - background-repeat: no-repeat
                      - height: 50px
                    name:
                      - justify-self: middle
                      - font-weight: null
                      - font-size: 15px
                      - padding-top: 10px
                  tap_action:
                    action: call-service
                    haptic: medium
                    service: remote.send_command
                    service_data:
                      command: menu
                      entity_id: remote.apple_tv_master_bedroom
                - type: custom:button-card
                  entity: media_player.apple_tv_master_bedroom
                  icon: mdi:arrow-down-bold
                  show_name: false
                  show_state: false
                  size: 10%
                  styles:
                    icon:
                      - color: white
                      - width: 40px
                      - height: 40px
                    card:
                      - border: 0%
                      - margin: 0px
                      - background-image: url('/local/logos/remote/button_background.png')
                      - background-size: cover
                      - background-repeat: no-repeat
                      - height: 50px
                    name:
                      - justify-self: middle
                      - font-weight: null
                      - font-size: 15px
                      - padding-top: 10px
                  tap_action:
                    action: call-service
                    haptic: medium
                    service: remote.send_command
                    service_data:
                      command: down
                      entity_id: remote.apple_tv_master_bedroom
                - type: custom:button-card
                  entity: media_player.apple_tv_master_bedroom
                  icon: mdi:home
                  show_name: false
                  show_state: false
                  size: 10%
                  styles:
                    icon:
                      - color: white
                      - width: 40px
                      - height: 40px
                    card:
                      - border: 0%
                      - margin: 0px
                      - background-image: url('/local/logos/remote/button_background.png')
                      - background-size: cover
                      - background-repeat: no-repeat
                      - height: 50px
                    name:
                      - justify-self: middle
                      - font-weight: null
                      - font-size: 15px
                      - padding-top: 10px
                  tap_action:
                    action: call-service
                    haptic: medium
                    service: remote.send_command
                    service_data:
                      command: home
                      entity_id: remote.apple_tv_master_bedroom
    badges: []
    cards:
      - square: false
        columns: 1
        type: grid
        cards:
          - square: false
            columns: 1
            type: grid
            cards:
              - type: custom:mini-media-player
                name: Master Bedroom
                volume_stateless: false
                hide:
                  power: true
                  source: true
                  icon: false
                  name: false
                  play_pause: false
                  prev: false
                  next: false
                  volume: true
                artwork: material
                toggle_power: true
                entity: media_player.apple_tv_master_bedroom
                group: false
                source: full
                icon: phu:apple-tv-box
                info: scroll
                tap_action:
                  action: more-info
                scale: '1.3'
      - square: false
        columns: 1
        type: grid
        cards:
          - square: false
            columns: 1
            type: grid
            cards:
              - type: custom:mini-media-player
                name: Kitchen
                volume_stateless: false
                hide:
                  power: true
                  source: true
                  icon: false
                  name: false
                  play_pause: false
                  prev: false
                  next: false
                  volume: true
                artwork: material
                toggle_power: true
                entity: media_player.apple_tv_kitchen_2
                group: false
                source: full
                icon: phu:apple-tv-box
                info: scroll
                tap_action:
                  action: more-info
                scale: '1.3'
      - square: false
        columns: 1
        type: grid
        cards:
          - square: false
            columns: 1
            type: grid
            cards:
              - type: custom:mini-media-player
                name: Family Room
                volume_stateless: false
                hide:
                  power: true
                  source: true
                  icon: false
                  name: false
                  play_pause: false
                  prev: false
                  next: false
                  volume: true
                artwork: material
                toggle_power: true
                entity: media_player.apple_tv_family_room_2
                group: false
                source: full
                icon: phu:apple-tv-box
                info: scroll
                tap_action:
                  action: more-info
                scale: '1.3'

Thanks in advance.