How To Chromecast Spotify From Your PC, iPhone and Android

Blog

Call the service

The spotcast custom component creates a service called ‘spotcast.start’ in Home Assistant.

Start playback on a device with default account

where:

  • spotify_device_id is the device ID of the Spotify Connect device
  • device_name is the friendly name of the chromecast device
  • uri is the Spotify uri, supports all uris including track (limit to one track)
  • search is a search query to resolve into a uri. This parameter will be overlooked if a uri is provided
  • category let spotify pick a random playlist inside a given category
  • country restrict country to use when looking for playlists inside a category
  • limit restrict number of playlists to return when looking in a category. Note that only a single playlist will be chosen randomly from them.
  • random_song optional parameter that starts the playback at a random position in the playlist
  • repeat optional parameter that repeats the playlist/track
  • shuffle optional parameter to set shuffle mode for playback
  • offset optional parameter to set offset mode for playback. 0 is the first song

Optionally you can specify the entity_id of an existing Home Assistant chromecast media-player like:

Find Spotify Device ID

To use the Spotcast service with a Spotify Connect device, you need the spotify_device_id. To find the spotify_device_id, multiple option are available.

With Spotify developper portal

  1. Go to Spotify developper console
  2. Click GET TOKEN
  3. Select user-read-playback-state as a scope
  4. If prompt give permission to your Spotify profile
  5. For chromecast devices, make sure to play media on the device prior to checking the logs as they will not show unless active
  6. Press the option Try it
  7. Read the result in the console in the right.

Through Spotcast log

  1. Enable the debug logs (instructions are in section Enabling Debug Log in this README)
  2. Reboot Home Assistant
  3. Go to Configuration >> Logs >> Load Full Home Assistant Log.
  4. For chromecast devices, make sure to play media on the device prior to checking the logs as they will not show unless active
  5. Find the log entry get_spotify_devices and look for the device ID.

Sonos Device ID

  1. Open the Spotify Web Player and sign in if needed
  2. Make sure you see your Sonos devices in the Connect popup
  3. Open your browser’s DevTools (F12 for Chrome)
  4. Navigate to the Network tab
  5. Connect to the desired Sonos device in the Web Player
  6. Find the associated request in your DevTools
  7. The request URL looks something like this: https://gew1-spclient.spotify.com/connect-state/v1/connect/transfer/from/my_web_player_device_id/to/my_sonos_device_id
  8. The my_sonos_device_id is the spotify_device_id you are looking for.
Log exemple

Automation example

Transfer current playback for the account

Omitting uri will transfer the playback to the specified device.

Use the parameter force_playback to continue the user’s playback even if nothing is currently playing.

where:

  • device_name is the friendly name of the chromecast
  • force_playback (optional) true or false, true to continue the user’s playback even if nothing is currently playing

Start playback on a device with non default account

where:

  • account is the name of account key in the accounts dictionary in the configuration
  • device_name is the friendly name of the chromecast
  • uri is the Spotify uri, supports all uris including track (limit to one track)

start podcast playack

Play the latest episode of a given podcast show.

where

  • account is the name of account key in the accounts dictionary in the configuration
  • device_name is the friendly name of the Chromecast
  • uri is the spotify uri, (podcasts use the ‘show’ uri)
  • ignore_fully_played (optional) true or false, true to ignore already fully played episodes (defaults to false and play the latest released episode)

Video

Can you use Spotify on your Chromecast device?

Yes. You can use Spotify directly on your TV using Chromecast and any other device you primarily use Spotify on other than your TV. Spotify on Chromecast works with Spotify apps on iOS, Android, Mac, Windows, and on the web; meaning you can cast music and podcasts via the service on your Chromecast device from your phone or your computer.

To get this done, you will have to rely on the Spotify Connect feature that’s available inside the music streaming service. In addition to streaming on Chromecast, Spotify Connect also lets you listen to music on speakers, TVs, computers, and other devices.

Can You Use Spotify On Chromecast?

Not only can you use Spotify with your Chromecast, but you can do so from nearly any device you own.

You can cast Spotify to Chromecast using the following devices as your audio remote control:

  • Desktop: Using the Spotify desktop app
  • Browser or Chromebook: Using the Spotify web player
  • Mobile: Using the mobile Spotify app or Google Home app

Each of these Spotify players includes a Devices icon where you'll find the feature to cast your Spotify music to your Chromecast device.

For the desktop app to cast to a Chromecast device, you'll need to install the Spotify app on your mobile first.

Chromecast Spotify From Your Desktop

To cast to Chromecast with Spotify, complete the steps above to connect your mobile device's Spotify app with Chromecast. Once connected, you can control the Chromecast Spotify music with the Spotify desktop app.

Spotify’s site has the Spotify desktop app for Windows or Mac OS.

If you don’t have one yet, sign up for a Spotify account. Once it’s installed, launch the Spotify desktop app, and log in with your Spotify account. From the main page, browse or search for the music you want to play.

  1. Launch the playlist or artist song list, and select what you want to cast.

  2. Select the Devices icon at the lower right corner of the window to bring up all available devices you can control. You should see the Chromecast device on your TV displayed in the list.

  3. If it isn't currently displayed in green, select the device to activate it. Now, you can control the music that plays from Spotify to your Chromecast device.

Community QA

Search
Add New Question Ask a Question 200 characters left Include your email address to get a message when this question is answered. Submit

Advertisement

Websocket API

The components websocket api.

Method: spotcast/playlist supporting different playlist_types.

  • user, or default for user chosen saved playlists
  • featured for spotify “featured” playlists (not personalized)
  • discover-weekly for personalized “Made for _____” (includes daily mixes)
  • recently-played for “Recently Played”
  • … any other view id as found in the API at

Example usage:

How to Stream the Converted Spotify Music on Chromecast

Chromecast doesn’t advertise itself for playing local music files, but it can. You can stream 320 kbps MP3 music playing on the big speakers attached to your giant TV in no time. Here are the best 3 ways to stream local Spotify music collection to Chromecast for listening to music out loud.

Tags