Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source shown in Spotify App, but not in HA Integration / Spotify API #234

Closed
Alwinator opened this issue Aug 9, 2023 · 1 comment
Closed

Comments

@Alwinator
Copy link

Problem/Motivation

Everything worked fine for a long time until I updated HA. After that I could still use Spotify Connect without a problem, however, the device was not shown anymore in the Spotify Integration. I first assumed it was an issue with the integration (see home-assistant/core#97867), however, after writing the following script I found out that it was the Spotify API.

config.yml

auth_manager:
    client_id: xxx
    client_secret: xxx
    redirect_uri: http://localhost:7777

test.py

import spotipy
import yaml
from spotipy import SpotifyOAuth

with open("config.yml", "r") as stream:
    config = yaml.safe_load(stream)

sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope="user-read-playback-state", **config['auth_manager']))
print("Authenticated as {}".format(sp.current_user()['display_name']))

res = sp.devices()
for device in res.get("devices"):
    print(device)

Expected behavior

The device should be listed in the Spotify sources.

Actual behavior

There are two devices listed, however my HA Spotify is not listed.

Authenticated as Alwin
{'id': 'xxx', 'is_active': False, 'is_private_session': False, 'is_restricted': False, 'name': 'My TV', 'supports_volume': True, 'type': 'TV', 'volume_percent': 6}
{'id': 'xxx', 'is_active': False, 'is_private_session': False, 'is_restricted': False, 'name': 'My PC', 'supports_volume': True, 'type': 'Computer', 'volume_percent': 100}

Steps to reproduce

  1. Setup HA with Spotify Connect with the same versions
  2. Use my attached script

Logs

In my opinion the logs are looking fine:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
-----------------------------------------------------------
 Add-on: Spotify Connect
 Play Spotify music on your Home Assistant device
-----------------------------------------------------------
 Add-on version: 0.12.4
 You are running the latest version of this add-on.
 System: Home Assistant OS 10.4  (aarch64 / raspberrypi4-64)
 Home Assistant Core: 2023.8.1
 Home Assistant Supervisor: 2023.08.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun spotifyd (no readiness notification)
s6-rc: info: service legacy-services successfully started
[20:18:36] INFO: Starting the Spotify daemon...
[2023-08-09T18:18:37Z INFO  librespot] librespot 0.4.2 UNKNOWN (Built on 2023-05-17, Build ID: PtL7ynVq, Profile: release)

It also works with the official Spotify app.

@Alwinator
Copy link
Author

Not sure what the root cause was, but this bug magically fixed itself. I assume it was a bug in the Spotify API and was fixed by the Spotify team.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant