Sennevds / media_player.template

Template media_player for Home Assistant
MIT License
126 stars 23 forks source link

feature request: "Browse_Media" #50

Open pho084 opened 10 months ago

pho084 commented 10 months ago

Hi first of thanks for this awesome integration.

it would be great if the "browse_media" function could be implemented

clicking this on the native media_player integration opens HomeAssistant's media section (c.f. screenshot below -- not my screenshot). Would be great to have this in media_player.template as well Screenshot 2024-01-21 163820 thanks again

Dawidooox commented 4 months ago

I also want this feature to be implemented, but I guess it can take some time to make it, so I found a workaround of this problem. You can combine media_player.template with Universal media player integration to take advantage of the features of both.

Just use your media_player.template entity as a first child in Universal media player and make sure to properly override browse_media_entity and play_media command to the media player, that supports it.

Here is a small code snippet (media_player.android_tv_template is an entity from media_player.template integration):

- platform: universal
  name: My Universal Media Player
  unique_id: my_universal_media_player
  device_class: tv
  children:
    - media_player.android_tv_template
    - media_player.android_tv
  browse_media_entity: media_player.android_tv
  commands:
    play_media:
      service: media_player.play_media
      target:
        entity_id: media_player.android_tv
      data:
        media_content_id: "{{ media_content_id }}"
        media_content_type: "{{ media_content_type }}"

After adding the code to configuration.yaml file and restarting Home Assistant you should get the media player entity from UMP integration, that will show your templated media player with browse media functionality.