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:
- How-To integrate Home Assistant Spotify media player that will allow you to control Spotify,
- 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.
Table of Contents
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.
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.
After the Spotify App is created click on the Edit Settings button and find Redirect URIs section. Under this section type the following:
If you are using SSL just replace http with https and click Add button.
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.
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:
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.
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.
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:
- A 3.5mm to 2-Male RCA cable or adapter (Amazon affiliate link) – https://amzn.to/3lAn9qE
- A Raspberry Pi (Amazon affiliate link) – https://amzn.to/37IPshF
Then you need to connect your Raspberry Pi on which you should have Home Assistant installed to your AUX input of your Sound System.
After that open Home Assistant > Supervisor > Add-on Store > and search for Spotify Connect > click on it and hit Install button.
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.
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!
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
Stay safe and don’t forget – Home Smart, But Not Hard!
Thank you for reading, I will see you in the next article.