Spotify playlist

Hi! Is it possible to send a spotify playlist to a google chromecast/audio device with home assistant. This is my config but I only got ideal when I execute the automation.

alias: Chromecast audio on - lungt & skönt i köket
  platform: state
  entity_id: input_boolean.spotify_lungtochskont
  state: 'on'
  - service: switch.turn_on
    entity_id: switch.google_audio_koket
  - delay: 00:00:03
  - service: media_player.play_media
    entity_id: media_player.kok
      media_content_id: ""
      media_content_type: "audio/PLAYLIST"
1 Like

Will this be possible with the new Spotify component?

Bump. I would love to make this work in my chromecast.

It is indeed now possible with the new Spotify component! I have not tested on a Chromecast, but I’m pretty sure it works. First, using your phone, open the Spotify app and play something on the chromecast.
Then setup the Spotify component according to its instructions:
Check that it is working by pausing and resuming something from within HA.

After that you can use the following (on a script or automation) to first select the chromecast:

  - service: media_player.select_source 
    entity_id: media_player.spotify
    source: "chromecast-name"

Then use the following to play a playlist:

  - media_player.play_media
    entity_id: media_player.spotify
    media_content_type: playlist
    media_content_id: spotify:user:spotify:playlist:37i9dQZF1DWXRqgorJj26U

How are you using the script to select the Chromecast as source?
As soon as my Chromecast goes idle it disappears from the source list and cant be chosen, until i manually start casting spotify to it again.

You have any workaround im unaware of?

I think you might be missing something:

- service: media_player.play_media

Is that how it’s supposed to look?

Yes! Thanks for noticing.

Hi, hope someone can help me. This post put me in the right direction for using Spotify but I am getting an error and I cannot see what’s wrong- Maybe someons can see whta’s wrong in this code (check configuration result):

Failed config

    - platform: spotify
    - entity_id: media_player.spotify
      service: media_player.select_source
      source: clazio
    - entity_id: media_player.spotify
      media_content_id: spotify:user:XXXXXXXXX:playlist:2kc39hzlsdfe01iVt8Myv2
      media_content_type: playlist
      service: media_player.play_media

Successful config (partial)

    - platform: spotify
      aliases: ?


I’m still a noob myself but I think your entity id ones don’t belong in configuration.yaml. Those look like they would be part of your automations.

For example, here is one I used for iheartradio a couple months ago in my automations.yaml. If you don’t have an automations.yaml and instead have your automation in your configuration.yaml, just do everything below with 2 more spaces under the automation part of your configuration.yaml

- alias: 'Turns on the chromecast and plays iHeartRadio on all devices each morning Monday thru Friday'
  initial_state: 'on'
  hide_entity: false
    - platform: time
      at: '06:10:00'
    - condition: time
       - mon
       - tue
       - wed
       - thu
       - fri
    - service: media_player.play_media
      entity_id: media_player.all_devices
        media_content_type: audio/mp3

Hi, what you have is clearly an automation but I do not want to start Spotify automatically, I want it to start by clickind Play on the dashboard interface. I believe I am inserting the code in the right place as seen in other threads as well as in the documentation (

Thanks for your help.

Thanks for understanding my limited ability to help people :slight_smile: Hopefully if nothing else these extra replies will help get your post seen by someone who can truly help.

1 Like

Hi, from another thread it seems that you are right, this must be in automations. I’ll try it and keep you posted.

Thannk you again.

Hi, I used your code and it was the only way to make it work. Thank you very much.

What I still do not understand is why I need a trigger when I just want to use it whenever I want. You use it for wakeup but I want to use it anytime.

Well, it’s working. Thanks and let’s start another war with the syntax.

By the way, do you know any doc that describes the syntax with all the options ? I find difficult to program because of this lack of information.


Yay I’m glad it helped after all :slight_smile:

I’ve been working on a way around this and posted over at Spotify Playlist Player