mini-media-player icon indicating copy to clipboard operation
mini-media-player copied to clipboard

`id` as an attribute identifier only

Open agneevX opened this issue 4 years ago • 1 comments

I'm trying to set the state of a shortcut button on Spotify which plays playlists.

Spotify exposes the current playing playlist as media_playlist as the name of the playlist, not the ID, so currently there is no way for the state of the

What I'm proposing is to designate id as the state of the shortcut, where it must match the attribute, but should not be used for playlist. Currently, when attribute: cannot be used alongside type: service.

If a shortcut button calls a service, instead of...

shortcuts:
  buttons:
    - icon: 'mdi:sunglasses'
      id: media_player.play_media
      type: service
      data:
        entity_id: media_player.spotify
        media_content_id: 'spotify:playlist:xxxxx'
        media_content_type: playlist

My proposal:

shortcuts:
  attribute: media_playlist
  buttons:
    - icon: 'mdi:sunglasses'
      id: Dr Disrespect
      type: service
      service_name: media_player.play_media
      data:
        entity_id: media_player.spotify
        media_content_id: 'spotify:playlist:xxxxx'
        media_content_type: playlist

*_name for other types such as playlist or script.

agneevX avatar Aug 20 '20 09:08 agneevX

@kalkih Hi. I have another case with a script where I pass the media URL as a variable:

  shortcuts:
    attribute: media_content_id
    buttons:
      - name: Radio Relax
        icon: 'mdi:panda'
        type: script
        id: play_radio
        data:
          entity_id: media_player.bathroom
          radio_url: 'http://ic7.101.ru:8000/v13_1'

So I need to compare media_content_id attribute not with id of the button, but with a variable of script. Could you suggest a solution, please?

leva3000 avatar Oct 08 '20 13:10 leva3000