We are going to test and review two things today that will help you create best possible Home Assistant Spotify Integration. And these things are:

  1. How-To integrate Home Assistant Spotify media player that will allow you to control Spotify,
  2. How-To add Home Assistant Spotify connect add-on which will allow you to use a Raspberry Pi to play your Spotify music on your existing audio system wirelessly.
How-To Home Assistant Spotify

Why Home Assistant Spotify?

What’s better than listen to some good music from Spotify? The only thing that I can think of is to automate and control Spotify from your Home Assistant, so we are going to do exactly that in the first half of this article.

Moreover if you’ve got an old Hi-Fi or sound system with an AUX input and a Raspberry Pi it will be possible to stream music to your audio setup from your phone, tablet, or laptop using Spotify Connect. And I will show you how to do that in the second half of this article.

Stay tuned till the end and be ready to smash the subscribe button for my weekly Newsletter at anytime.

Now let’s start this:

No Home Assistant?

By the way If you don’t have Home Assistant yet, go get one using one of these tutorials of mine.

  1. Install Home Assistant using 2 different ways – LINK
  2. Install Home Assistant using VirtualBox – LINK

And then come back right here.

Get Spotify Credentials needed for Home Assistant.

Head over to https://developer.spotify.com address and log in there with your existing Spotify account. If you don’t have account yet – just create one.

And fon’t worry we are not going to develop anything. We will simply create an app, so we can get a Spotify Client ID and Client Secret that are needed for Home Assistant.

When you log in. Click on the Create an App button and enter an App name, App description and select the two check boxes to accept the Spotify terms & conditions.

Create a Spotify App to get the Client ID and Client Secret needed for Home Assistant Integration
Create a Spotify App to get the Client ID and Client Secret needed for Home Assistant Integration

After the Spotify App is created click on the Edit Settings button and find Redirect URIs section. Under this section type the following:

http://<your_home_assistant_url_or_local_ip>:<port>/auth/external/callback

If you are using SSL just replace http with https and click Add button.

Adding the Redirect URIs address needed for the Home Assistant Spotify integration

Add the Redirect URIs and save the changes

Finally copy your Spotify App Client ID and Client Secret and head over to your Home Assistant.

Copy your Client ID and Client Secret from your Spotify app and go to Home Assistant
Copy your Client ID and Client Secret from your Spotify app and go to Home Assistant.

Add Spotify Credentials in Home Assistant

We have what’s needed from Spotify and we can now add it to the Home Assistant configuration. Just open your configuration.yaml file and add the following text inside:

# Example configuration.yaml entry
spotify:
  client_id: YOUR_CLIENT_ID
  client_secret: YOUR_CLIENT_SECRET

Save the file and restart your Home Assistant.

Home Assistant Spotify Integration

Activating the Spotify Integration in Home Assistant is the next step and it is very easy. Let’s activate it.

In Home Assistant, go to Configuration > Integrations > Add Integration > search for Spotify > click on the result > Open Website > Agree.

When you return back to Home Assistant you should see a very similar dialog:

Successful Home Assistant Spotify Integration
Successful Home Assistant Spotify Integration.

If you can’t see such dialog, then you can double check your callback address, that is the Redirect URIs from the previous step. You may want to try with local or external Home Assistant address and with or without SSL (http or https).

Add Spotify player to Home Assistant

Now we can add the Spotify player to Home Assistant Lovelace.

Go to Home Assistant Dashboard > click on the three dots menu in the upper right corner > Edit Dashboard > Add Card > Search and add Media Control card > As Entity select your media_player.spotify_SOMETHING > and finally click Save button.

Adding Spotify Media Player to Home Assistant Lovelace.
Adding Spotify Media Player to Home Assistant Lovelace.

To play, pause, next and so on from Home Assistant a Spotify Premium account is required. If you do not have a Premium account, the Home Assistant frontend will not show these controls. As you can see form the picture below.

Spotify Media Player in Home Assistant without Spotify Premium Account.
Spotify Media Player in Home Assistant without Spotify Premium Account.

What is Home Assistant Spotify Connect?

Spotify connect is streaming protocol that allows you to listen music on your speakers or TV, using the Spotify app as a remote. Very similar to the Apple AirPlay or Google Cast. Home Assistant Spotify Connect add-on can help you to enable that streaming option on your device. In our case we will use a Raspberry Pi on which Home Assistant is installed.

For whom is the Home Assistant Spotify connect?

A lot of people have older and probably still great, high-quality audio systems that no longer get used, simply because they’re inconvenient. Enabling Home Assistant Spotify connect add-on is a quick fix for that.

Running Home Assistant on a Raspberry Pi with the Spotify Connect add-on installed will allow you to play your Spotify music via the Raspberry. All you’ll have to do is connect your sound system to the Pi!

Let’s see how we can do this.

What you need?

To enable the Home Assistant Spotify Connect you will need the following:

Then you need to connect your Raspberry Pi on which you should have Home Assistant installed to your AUX input of your Sound System.

Connecting the Raspberry pi with 3.5mm to 2-Male RCA cable to Sound System AUX input.
Connecting the Raspberry pi with 3.5mm to 2-Male RCA cable to Sound System AUX input.

After that open Home Assistant > Supervisor > Add-on Store > and search for Spotify Connect > click on it and hit Install button.

Installation of Home Assistant Spotify connect add-on.
Installation of Home Assistant Spotify connect add-on.

After the installation is finished open the Configuration tab of the Spotify connect add-on and enter your Spotify username & password.

name: HomeAssistant
bitrate: 160
username: YOUR_SPOTIFY_USER
password: YOUR_SPOTIFY_PASS

Save the changes and start the Home Assistant Spotify Connect add-on.

Now open your Spotify client and click on the Devices Available in the lower right corner and search for a device named HomeAssistant (or whatever name you choose) to stream your music.

This is from where you can stream music after your Spotify Connect add-on is up and running.
This is from where you can stream music after your Spotify Connect add-on is up and running.

For good or for bad the Home Assistant Spotify connect add-on requires a Spotify Premium account.

Let me know if you have Spotify premium and this feature is working for you in the comments bellow.

I have a Patreon!

As you may know or may not know – I have a Patreon page where it is possible to support my work on a monthly basis.

And I’m really happy to announce that I have my first, real Patreon – Dan T.

@Dan T, I’m really glad that I have you here and I really hope that you enjoy my humble supporter benefits – they are from the heart!

Summary

I really hope that you find this information useful and you now know more about the Home Assistant and Spotify media player integration and Home Assistant Spotify connect add-on.

If you want to secure this blog existence you can become one of my supporters. You can see exactly how in this section of my site.

Any other sort of engagement on this site and my YouTube channel does really help out a lot with the Google & YouTube algorithms, so make sure you hit the subscribe, as well as the Like and Bell buttons.

You can also buy my Smart Home Getting Started Actionable Guide right here -> LINK

Also feel free to add me on Twitter by searching for @KPeyanski.  You can find me on my Discord server as well.

Stay safe and don’t forget – Home Smart, But Not Hard!

Thank you for reading, I will see you in the next article.


2 Comments

Tim · 20/12/2020 at 11:24 pm

Hey there, I used your guide to upgrade my AV surround set with my new Home Assistant. The sound was distorted at first but that somehow resolved itself. Thank you for the details!

    Kiril · 21/12/2020 at 10:21 pm

    Very glad that I helped and it is very strange for the sound distortion.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.