Skip to content

Device Configuration Options

Todd Lucas edited this page Feb 26, 2024 · 239 revisions

Spotify Developer Application Configuration

Prior to configuring the SpotifyPlus integration, we need to make sure that it has the necessary authorization and permissions to access your Spotify user-account(s) that will be used in Home Assistant.

To do this, we must create an Application in the Spotify Developer Portal. This application will contain Client ID and Client Secret values, which will be used by Home Assistant OAuth2 security to grant access to the SpotifyPlus integration for access of Spotify resources on your behalf.

You may proceed to the SpotifyPlus Integration Configuration section if you have already created a Spotify Developer Application, and have your Client ID and Client Secret values.

Otherwise, use the following steps to create a Spotify Developer Application.

Step 1 - Create a Spotify User Account

An active Spotify account is required. If you don't have a Spotify user account, then hop out to the Spotify web-site and create an account.

A premium-level account is recommended, as Spotify limits playback operations (e.g. play, pause, adjust volume, skip to the next track, etc) to premium-level accounts. You will need a premium-level membership if you want to control the Spotify Connect player from Home Assistant. Note that the premium-level membership does require a monthly service fee.

A free-level membership will also work, but you will only be able to browse media and retrieve player playback status with it (no player control, no playing of media content from Home Assistant).

Step 2 - Create Spotify Developer Application

This step will create a new Spotify Developer Application for your Spotify user-account. This will need to be done for each Spotify user-account that you wish to access from the Home Assistant SpotifyPlus integration, regardless of membership level (premium or free).

A - Go to the Spotify for Developers portal and log in using your Spotify credentials. The login button is located toward the upper-right of the screen. Once you are logged in, go to the Spotify Developer Dashboard. The dashboard (see Figure 2a) is where you can create apps, control the API credentials bound to the app, or just get some nice app usage statistics.

Figure 2a - Spotify Developer Dashboard

B - Click on the Create App button to start the application create process (see Figure 2b).

Use the following details for the input fields on the form - note that it is VERY IMPORTANT that you get the Redirect URI correct, as it is case-sensitive and must match exactly what is specified below:

  • App name: Home Assistant Spotify Plus Integration
  • App description: Home Assistant integration that allows Spotify content to be played for a Premium user account.
  • Website: https://www.home-assistant.io/
  • Redirect URI: https://my.home-assistant.io/redirect/oauth
  • API/SDKs used: Web API
  • Accept the terms and conditions by checking the box.
  • Click the Save button to save the application.

Figure 2b - Spotify Developer Create App

Now that the application has been created, we can look at the settings to retrieve the client id and client secret values.

C - Click on the Settings button to view the application details form (see Figure 2c).

Figure 2c - Spotify Developer App Details Form

You will need to click on the View Client Secret link in order to view the secret.

Copy down the Client ID and the Client Secret values, and store them in a safe place. We will be entering these values into Home Assistant in a later step. In our example, the client id is 95576e7c24e94c2d839068aa1b2e7f5e, and the client secret is 28e0224edc8c4419b9adb6feddf33ca6. Note that you cannot use OUR example values, as they have been deleted by the time this document is published.

Your new application contains your Client ID and Client Secret needed to authorize the SpotifyPlus integration to use Spotify resources via Home Assistant

We are now ready to configure the SpotifyPlus integration.

SpotifyPlus Integration Configuration

There are currently no configuration options for the SpotifyPlus integration itself, though that may change in the future. There are OAuth2 application credentials that need to be defined though, which require the Client ID and Client Secret values from your previously defined Spotify Application(s).

Application Credentials are Spotify user specific - authorization and access cannot be shared amongst multiple Spotify users. You will need to configure credentials for each Spotify user that you wish to access Spotify resources for via the integration.

See the Spotify Developer Application Configuration section above if you need to create Client ID and Client Secret values for a Spotify User.

A premium-level account is recommended, as Spotify limits playback operations (e.g. play, pause, adjust volume, skip to the next track, etc) to premium-level accounts. You will need a premium-level membership if you want to control the Spotify Connect player from Home Assistant. Note that the premium-level membership does require a monthly service fee.

A free-level membership will also work, but you will only be able to browse media and retrieve player playback status with it (no player control, no playing of media content from Home Assistant).

Define Application Credentials

Go to the Application Credentials page to define OAuth2 application credentials to Home Assistant for a Spotify user. This is located under Settings \ Devices & Services \ Application Credentials (have to click the 3 dots menu in the upper right corner).

Click on Add Application Credentials button to add a new credential.

Fill in the Credential Form fields:

  • Integration: SpotifyPlus (select from dropdown list).
  • Name: Enter a name for the credential. I would suggest using "Spotify FIRST LAST" for this value, with FIRST being the Spotify user first name and LAST being the Spotify user last name (e.g. "Spotify John Smith").
  • OAuth client ID: The Client ID value for the Spotify User.
  • OAuth client secret: The Client Secret value for the Spotify User.
  • click Add to add the credentials.

We are now ready to add the SpotifyPlus integration service for the user.

Add SpotifyPlus Integration Service

Go to the SpotifyPlus Integration Details page to add a service for a Spotify user account.

Perform the following steps to add the integration:

  • Click the ADD SERVICE button to add a new SpotifyPlus service.

    The Select SpotifyPlus OAuth Credential form is displayed:

  • Check the button next to the Application Credential item that was previously defined. Click Submit to start the Spotify authorization process.

    Home Assistant OAuth2 security will now open a secure browser window to the Spotify authorization web-site, prompting you for your Spotify login credentials:

  • Enter your Spotify username and password credentials.

    Note that the Spotify login prompt may be bypassed if you have logged into Spotify before and are using cached credentials. If that is the case, you will see the Authorize Form instead. If this happens, MAKE SURE that the Spotify user display name is the same Spotify account that you entered Application Credentials for!

  • Click on Agree to allow Home Assistant to access Spotify resources on your behalf.

  • Click on Link Account to allow Home Assistant to link the OAuth2 Application Credential to Spotify.

  • Verify the Success result and click on FINISH to complete the setup for this user.

Repeat the Add SpotifyPlus Integration Service steps for each Spotify user account that needs to be added.

Clone this wiki locally