Switch between media player

Hi
I Use a state-switch to change the cards between my media control cards. Instead of changing the complete card which gives me alot of duplicated lines can i instead change the entity of the card? In my case i want to change it to kokken if input_boolean_kokken = “ON” and the same with badevaerelse. I have an automation to switch between the two states now. I believe it should be possible with lovelace_gen or maybe template card, but i dont know how to set it up. Can someone help me on the way.

- type: custom:state-switch
  entity: input_select.select_sonos_source  
  states:
    Køkken:   
      type:  media-control
      entity: media_player.kokken     
    Badeværelse:   
      type: media-control
      entity: media_player.badevaerelse