# Spotify on Home Assistant Here I would like to share my personal experience of setting up [Spotify](https://spotify.com/) streaming music on home server ![](https://i.imgur.com/YU82Dgs.png) ## What I have There is a Rasbperry Pi 4 and Home Assistant [Core](https://www.home-assistant.io/installation/raspberrypi#install-home-assistant-core) installed There is also a sound amplifier connected to the Raspberry Pi with mini jack to mini jack cable ## What I want I want to control Spotify music in Home Assistant dashboard and I want the computer be a client of Spotify. I'm aware there is the [Spotify Integration](https://www.home-assistant.io/integrations/spotify/) for HASS and we'll get to it later. The problem is I need a running device (smartphone, TV, laptop) with Spotify client so I need to make my Raspberry Pi the client of the streaming service. And here's what I found ## Spotifyd [Spotifyd](https://github.com/Spotifyd/spotifyd) - an open source Spotify client running as a UNIX daemon. This is going to be our Spotify client. Unfortunatelly there was no binary for Raspberry Pi 4, so I built it myself. 1. Install Rust and dependencies ``` curl https://sh.rustup.rs -sSF | sh sudo apt install pkg-config libasound2-dev ``` 2. Download the repository and build ``` git clone https://github.com/Spotifyd/spotifyd cd spotifyd cargo build --release ``` 3. Find out the output audio device ``` aplay -L ``` In my case it was `bcm2835` 4. Edit spotifyd configuration Put your credentials in the config, specify the output device, give the client a name. I also commented `volume_controller` due to some errors, but in the end it worked ## Spotify-tui [Spotify TUI](https://github.com/Rigellute/spotify-tui) - a Spotify client for the terminal written in Rust. It's just a UI that allows us to control any connected device, but it's not a client. In order to make it work with spotifyd follow the simple steps from [here](https://github.com/Rigellute/spotify-tui#using-with-spotifyd). At this point we are able to control music with spt. Start any song, in the last step we'll control the streaming from Home Assistant ## Control Spotify in Home Assistant Install and setup [Spotify integration](https://www.home-assistant.io/integrations/spotify/). It's pretty strightforward. I chose [Mini Media Player](https://github.com/kalkih/mini-media-player). It has many options to customize with outlook and it supports Spotify. > If you haven't found `config/www` directory, create one so it'll look like `~/.homeassistant/www` Finally add the card to the dashboard ![](https://i.imgur.com/lsfqHVl.png)