This addon allows you to play Spotify music on your HomePods.
It is based on OwnTone and librespot-java. And can be integrated into Home Assistant with the OwnTone integration.
Please keep in mind that this addon is experimental. I am using it by myself for two weeks without any major issue. But small audio drops (for like 1-10 seconds) are really common. So please do not report them.
Features
- OwnTone & librespot-java inside one Docker image
- Ready out of the box with zeroconf & Home Assistant integration
- Control OwnTone through Home Assistant
- Metadata support (visible in Home Assistant)
- Fully customizable through the config files in
/config/owntone
Requirements
- A Spotify Premium account
- At least one HomePod
- Correct set up in the Home app
- Home → Home Settings → Allow Speaker & TV Access → Anyone On the same Network
- Home → Home Settings → Allow Speaker & TV Access → Require Password: Disabled
- VSCode addon or any other text editor to edit the configuration
Limitations
- You cannot control the playback through the HomePods. Only through Spotify. (Volume adjustments are possible, though)
- Sometimes the addon becomes unresponsive. A restart should fix it.
- The streams are maybe not in perfect sync. You will notice that if you have multiple HomePods in the same room.
- Sometimes the playback stops for a few seconds and then continues afterwards. (Without issuing play/pause commands)
Installation
Configuration
You can use the VSCode add-on to customize the configuration.
You can configure OwnTone through its configuration file. It can be found at /config/owntone/owntone.conf
.
Librespot-java is configurable through its configuration file at /config/owntone/librespot-java.toml
After adjusting something, please restart the add-on.
Access OwnTone
You can access OwnTone through [Home Assistant IP]:3689
OwnTone Credentials
Username: admin
Password: owntoneadmin8765
Automation
I also created a blueprint that can automatically start and stop music in different rooms. You just need to provide an occupancy or motion sensor.
Import the blueprint:
Troubleshooting
I cannot see the Home Assistant speaker through Spotify Connect.
Currently, I am not certain why this is the case. I guess something does not work with the discovery in every setup correctly. But as an alternative, you can provide your Spotify credentials directly to librespot-java.
For that, please edit the librespot-java.toml
and set the strategy
to USER_PASS
additionally, please input your username/email address and password. (Afterwards, please restart the addon) Example:
[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_USERNAME_OR_EMAIL_HERE"
References
- This addon is inspired by the OwnTone addon from a-marcel
- Source code of the Docker image: https://github.com/AlexanderBabel/custom-images/tree/main/owntone
- Source code of the addon: GitHub - AlexanderBabel/hassio-addons: Hass.io Add-ons by AlexanderBabel