How to create a card to display TV on/off toggle and input selection only?

I’m using the LG webOS integration for my LG C1 TV but it defauls to using the media player dashboard card.

How can I create a card (?) that displays an on/off toggle and then an input selection? (the LG webOS integration shows possible inputs but I just want to change the input without having to click on the entity, etc).

Do I need to create a custom card or can something be configured to function like the above?

Have a look at the mini-media-player card. It is highly customisable.

Thanks! I’ve seen that and I’m definitely going to look into it, but just for my knowledge, is it possible to do this without the different card?

For example, can I somehow show the media_player source_list as an input_select or something to get it to show up on the Entities card?

Not easily as the configuration options of an input_select helper do not support templating. At least not directly in the config of the input select.

You can create an input_select but setting the options to the source list of the media player requires an automation. Then you would require another automation to change the media_player source whenever the input_select was changed.

Input select

input_select:
  media_source:
    name: Media Source
    options:
      - Not loaded

Automations to load the options to the input select

trigger:
  - platform: homeassistant
    event: start
action:
  - service: input_select.set_options
    target:
      entity_id: input_select.media_source
    data:
      options: "{{ state_attr('media_player.your_media_player_here', 'source_list') }}"

Automation to change the media source when the input select is changed

trigger:
  - platform: state
    entity_id: input_select.media_source
    to:
action:
  - service: media_player.select_source
    target: 
      entity_id: media_player.your_media_player_here
    data:
      source: "{{ trigger.to_state.state }}"

Thanks very much. It looks quite a bit more complicated than just using the alternatives but that helps me understand how it works!

Hi tom_l,
I noticed there is a closing bracket missing in ‘Automations to load the options to the input select’, maybe you want to edit your solution.

“{{ state_attr(‘media_player.your_media_player_here’, ‘source_list’) }}”

1 Like

Gives on my end
Message malformed: expected a dictionary for dictionary value @ data[‘action’][0][‘target’]

Changed it to

target:
  entity_id: media_player.your_media_player_here
1 Like

Both fixed. Thanks.

Just started down the HA rabbit hole, and this solved the exact thing I wanted, so thank you very much.

However, I struggled a bit with this trying to figure it out, the source_list attribute wasn’t returning anything. Until I realized after discovering the STATES tab in developer tools that the source_list doesn’t appear unless the TV is powered on.

So I think the source load automation could be improved by updating the list when the TV powers on rather than when HA starts.

That’s easy enough to do:

trigger:
  - platform: state
    entity_id: media_player.your_media_player_here
    from: 'off'