Spotify media source selection

Hi, I’m trying to create a frontend UI button with glance card to switch my media player source from spottify. I am able to call for this service under the Developer Tools.

> service: media_player.select_source
> data:
>   source: Bose Soundbar 700
> target:
>   device_id: 3faa4357f97911ea91d6e7fddde21ae5

Under my glance card this is the code used. I manage to get the button to work once however i edited something and couldn’t get it back working again. Anyone has any idea on how i can get this to work?

> type: glance
> entities:
>   - entity: media_player.spotify_abc
>     tap_action:
>       service: media_player.select_source
>       data:
>         source: Bose Soundbar 700
>       target:
>         device_id: 3faa4357f97911ea91d6e7fddde21ae5
>   - entity: media_player.googlehome8657
>     tap_action:
>       action: call-service
>       service: spotcast.start
>       service_data:
>         entity_id: media_player.googlehome8657
>   - entity: media_player.master_bedroom_speaker
>     tap_action:
>       action: call-service
>       service: spotcast.start
>       service_data:
>         entity_id: media_player.master_bedroom_speaker
>   - entity: media_player.study_room_wifi
>     tap_action:
>       action: call-service
>       service: spotcast.start
>       service_data:
>         entity_id: media_player.study_room_wifi
> state_color: true

It looks like you’re missing an action in the tap_action from media_player.spotify_abc

I tried adding

Action: call-service 

But still couldn’t work

You need service_data instead of data, and most probably an entity_id aswell under it.

Hi Suxlala, i actually ran this call service code within the developer tools services section and it works. So the code should work without making any additional edits to it right? It is only when i placed it into the “tap_action” then it stopped working. It actually worked when I first added it there without any further edits apart from moving the indentations. However, I could not remember what and where was moved to get it working the second time.

Code from Call Service, this works on its own there

service: media_player.select_source
data:
  source: Bose Soundbar 700
target:
  device_id: 3faa4357f97911ea91d6e7fddde21ae5

Try “action: call-service” with lowercase “A” at the beginning and use service_data in conjunction with a tap_action, just as in your other actions.
This is a working example:

tap_action:
  action: call-service
  service: media_player.select_source
  service_data:
    entity_id: media_player.kitchen
    source: Rádió 1 

I’m not sure about target: and device_id: as I never used them.
Hope this helps.