Connecting your Spotify account to Home Assistant allows for powerful and seamless music streaming across your entire smart home. With just a few clicks, you can enable multi-room audio, customize playback controls, set up voice commands, and automate playlists based on schedules or system events.
This guide will walk through the full integration process, core usage, advanced features, and FAQs to help you get the most out of the Home Assistant Spotify integration.
Table of Contents
Overview of Spotify Home Assistant Integration
Home Assistant offers a native Spotify integration that connects your Spotify account to your Home Assistant instance. Once connected, you can:
- Play/pause/skip tracks on Spotify Connect devices
- View what’s currently playing in Home Assistant
- Build automations and scripts based on track info, devices, etc.
- Control playback via Home Assistant media players
- Cast music to Google, Amazon, and other speakers
The options are almost endless when you link up Spotify with Home Assistant. Read on to learn how to set up the integration and start building custom commands, scripts, and automations.
Connecting Spotify and Home Assistant
Connecting your Spotify account to Home Assistant is a fast and easy process thanks to the native Spotify integration.
Prerequisites
To connect your Spotify account to Home Assistant, you’ll need:
- An active Home Assistant instance – hosted yourself or via a provider. Home Assistant OS is recommended rather than Home Assistant Core for the easiest audio setup.
- A free or premium Spotify account that you can sign in to. Note that a Premium account is required for speaker group and multi-room streaming.
- A Spotify Developer application (free).
Create a Spotify Developer Account
Go to Spotify Developer Dashboard and log in or create an account
Click the Create app button from the top right of the dashboard page
Give the app a name and description. Agree to terms.
For the Redirect URI box enter: https://my.home-assistant.io/redirect/oauth
Once registered, view details and copy the Client ID and Client Secret as you will need this for the next steps when adding the integration to Home Assistant.
Adding Spotify Integration
To add the Home Assistant Spotify integration, simply follow the steps below.
- From the HA front-end, go to Settings then Devices & Services.
- Click the + Add Integration button to add an integration.
- Search for and select Spotify.
- Click to submit and open the Spotify authorization flow.
Signing into Spotify
- The integration will redirect you to Spotify’s website.
- Login with your Spotify username and password when prompted.
- Click Agree to authorize Home Assistant to access your Spotify account.
Once authorized, your Spotify account will be connected to Home Assistant!
Tip
The Home Assistant Spotify integration allows you to link more than one Spotify account to your HA instance, simply repeat the steps above while logging in to a different Spotify account!
Playing Music on Spotify Devices
Out of the box, connecting Spotify to Home Assistant allows you to use the platform to play, pause, skip tracks and view what’s playing on Spotify Connect devices like:
- Smart speakers (Amazon Echo, Google Home)
- Smart TVs
- Gaming consoles
- Headphones/earbuds (if Spotify Connect enabled)
After linking your Spotify account, a new Spotify media player entity will automatically appear in Home Assistant.
Controlling Music Playback
On the Home Assistant frontend:
- Navigate to the Spotify integration card
- Browse featured playlists or search artists, albums etc.
- Click tracks, playlists or albums to begin playback
- Use transport controls like play/pause, next/previous track
- Adjust volume for connected speakers
You can also add shortcuts or visual buttons on your dashboard or in Lovelace to control playback.
Streaming Music on Speakers
To stream Spotify music throughout your home, you simply need to:
- Ensure speakers are connected to your Home Assistant instance (Bluetooth, Chromecast etc).
- In Spotify integration, under advanced options, enable audio streaming and select your audio output.
- Start playback – music will now stream to the selected speakers.
Group speakers together from the configuration panel for synchronized multi-room audio.
Advanced Configuration
Once up and running with Spotify playback, you can further customize the experience:
Multi-room audio
Group speakers together like kitchen and living room for:
- Synchronized music streaming across rooms
- Single playback control interface
Group via Home Assistant’s media player integration, then select this group in Spotify config.
Customizing Playback Controls
Further tailor controls like:
- Compact mini-players
- Card-based UIs
- Dashboard buttons
- Tablet control panels
- Voice commands
All allow easy music control while presenting relevant information.
So if you have Spotify playing music on your Living Room Echo, the above services would control playback on that device.
Pretty cool right? Read on to learn how to build on top of that.
Displaying Spotify Info in Home Assistant
Beyond basic playback controls, integrating Spotify gives you access to a wealth of data about what’s playing within Home Assistant.
For example, your Spotify media player entity will expose attributes like:
- media_title – Song name currently playing
- media_artist – Artist name
- media_album_name – Album name song is on
- media_duration – Length of the song
You can display this info on your Home Assistant dashboard with widgets like Entity attributes, Mini media player, etc.
This data also opens up a lot of options for automation and scripting down the road.
But first, let’s look at how to build custom media player controls for Spotify.
This allows randomizing playlists or repeating that favorite track you just can’t stop listening to.
Home Assistant Spotify Automation Ideas
Here are just a few ideas to spark your creativity on ways to automate Spotify with Home Assistant:
Random Morning Playlist
Trigger a random upbeat playlist to start when your alarm stops in the morning. Simple way to start the day off right.
Bedtime Wind Down
When the last person goes to bed, pause Spotify and play a sleepy relaxation playlist to unwind at the end of the day.
Dinner Party Mode
Got friends coming over for dinner? When they arrive, pause any devices and cast a dinner playlist to your Google Home speaker in the kitchen.
Flash Briefing Playlist
Start each day with a personalized news briefing. When your morning alarm stops, play a special playlist while reading the daily news and weather.
The options are endless here. Next let’s look at some example scripts to actually build the automations.
Sample Home Assistant Spotify Scripts
To turn ideas into reality, here are two sample scripts for automating Spotify with Home Assistant using the script integration:
Random Morning Playlist
Configuration YAML:Copy code
script: spotify_wakeup_playlist: alias: "Wake Up Playlist" sequence: - service: media_player.shuffle_set entity_id: media_player.spotify shuffle: true - service: media_player.media_play entity_id: media_player.spotify - delay: 00:05 - service: media_player.volume_set entity_id: media_player.spotify volume_level: 0.30 - delay: 00:30 - service: media_player.volume_set entity_id: media_player.spotify volume_level: 0.15
To enable, create an automation triggered by your morning alarm that runs the spotify_wakeup_playlist script.
Bedtime Ambience
Configuration YAML:Copy code
script: spotify_bedtime: sequence: - service: media_player.media_pause entity_id: media_player.spotify - service: media_player.select_source entity_id: media_player.kitchen_speaker source: Night Noise Skill - delay: 00:30 - service: media_player.volume_set entity_id: media_player.kitchen_speaker volume_level: 0.15
Automate by triggering the script when the last person goes to bed.
With some basic YAML, you can start bringing your Spotify automation ideas to life in Home Assistant!
Resources
Some additional references for taking things further:
- Spotify Integration Documentation – Technical setup details
- Automation Cookbook – Event triggers
- Blueprint Exchange – Automation code templates
Frequently Asked Questions
Below are answers to some common questions about integrating Spotify with Home Assistant.
Can I control Spotify playback on my phone?
Unfortunately the Spotify integration only allows controlling Spotify Connect devices, not playback on the Spotify phone app itself.
Do I need a Spotify premium account?
A premium account is not required for integration with Home Assistant but it is recommended.
What speakers can I cast to from Home Assistant?
You can cast to any Spotify Connect enabled speakers like Sonos, Google Home, Echo, as well as directly to Chromecast.