AlexanderBabel / owntone

HomePod Connect: A custom OwnTone Docker image with librespot-java
1 stars 0 forks source link

Spotify Connect Integration #9

Closed ThunderBuild89 closed 1 year ago

ThunderBuild89 commented 1 year ago

Great to start Music from Spotify via http://owntone.local:3689/#/ An Spotify Connect Integration would be awesome! Any Ideas how to integrate Spotify Connect? I want to select music in the Spotify Mobile app and then play it on one or more HomePods.

AlexanderBabel commented 1 year ago

Hey, this is the base idea of the docker image. For that, just run it on the docker host network, and you can discover inside your Spotify app a new speaker called Home Assistant.

PascalTrm commented 1 year ago

Hey, really like the Add-On, thanks for the work! However I can‘t use Spotify Cast to play music using Owntone, even though the Add-On uses the Host network. I‘m able to open the Web UI from my phone and laptop without any problems and I‘m able to play music through OwnTone using the Media Player and Spotify integration. Do I have to configure something in order for the server to show up in Spotify cast?

AlexanderBabel commented 1 year ago

It should work out of the box. If it is not working, you can try to modify the librespot-java.toml file. There you can adjust the auth section. Just change the strategy to USER_PASS and provide your Spotify credentials.

[auth]
    # Credentials file (JSON)
    credentialsFile = "/config/owntone/credentials.json"
    # Spotify password (USER_PASS only)
    password = "SPOTIFY_PASSWORD_HERE"
    # Spotify authentication blob Base64-encoded (BLOB only)
    blob = ""
    # Whether to store reusable credentials on disk (not a plain password)
    storeCredentials = true
    # Strategy (USER_PASS, ZEROCONF, BLOB, FACEBOOK, STORED)
    strategy = "USER_PASS"
    # Spotify username (BLOB, USER_PASS only)
    username = "SPOTIFY_USER_OR_EMAIL_HERE"
PascalTrm commented 1 year ago

Thanks for the quick answer. Is there a way to use the secrets file in this config, so I don’t have to provide my Spotify password in plain text?

Just using !secret spotify_password and adding it to the secrets file isn’t working.

AlexanderBabel commented 1 year ago

You can provide your credentials once and then switch to the STORED strategy. For that, librespot-java uses the credentials.json file. Your credentials should be stored (not in clear text) in this file after the first successful connection with the Spotify servers.

AlexanderBabel commented 1 year ago

!secret is only working for ESPHome and Home Assistant configuration files. It is a custom feature from them.

PascalTrm commented 1 year ago

Thanks, that did the trick. Just had to restart the Owntone integration after restarting the Add-On.

Might be worth mentioning this in the documentation, as I couldn’t find any details regarding the Spotify connect integration.

AlexanderBabel commented 1 year ago

Thanks for the hint. I added this to the troubleshooting section in the community forum.