home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.52k stars 30.71k forks source link

Spotify Integration stops to work with 0.115 HA #40194

Closed arripeo closed 4 years ago

arripeo commented 4 years ago

The problem

After update to 0.115 version in integration page the spotify integration ask to be riconfigured. I've pushed the button and the system say "operation aborted". Then I've tried to reinstall integration by ui interface and the system says "operation aborted". Now my spotify integration and entities desappered

Environment

HassOS installation HassOS 4.13 Supervisor 245 stable HA 0.115 Hardware Rasperry PI4 4GB

Previusos HA 0.114.4 spotify working correctly

Problem-relevant configuration.yaml

Traceback/Error logs

NO logs was detected

Additional information

mckochan commented 4 years ago

Uninstall custom integrations related to Spotify such as spotcast, I also uninstalled Spotify card just to be safe. See #40032

Sholofly commented 4 years ago

I had spotcast installed, Uninstalled it and rebooted but same result.

probot-home-assistant[bot] commented 4 years ago

spotify documentation spotify source (message by IssueLinks)

probot-home-assistant[bot] commented 4 years ago

Hey there @frenck, mind taking a look at this issue as its been labeled with an integration (spotify) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

frenck commented 4 years ago

Anything in the logs? As in, I'm not having this issue and there is not much to work with / go on in this issue.

Some additional pointers:

areeeee commented 4 years ago

I had this problem. Solved it by setting internal and external url. Thanks!

N1c093 commented 4 years ago

Setting the right internal and external url fixed it for me as well. (I changed my domain last month) Maybe we should add this hint on the spotify integration page?

Sholofly commented 4 years ago

Still doesn't work for me. it fails when adding the integration through the UI. In the config popup as soon as i click the spotify integration from the list I get the message "Afgebroken" (same as TS but in dutch). So that has nothing to do with the redirect URL I think. I have added both URLs (internal and external) to be sure in my dev console. There's nothing in the logs, even with debug level 'debug' enabled.

frenck commented 4 years ago

Maybe we should add this hint on the Spotify integration page?

It should have popped up in your dialog, so am I looking at that 👍

@Sholofly I'm sorry, but I don't have much to work from in your report 😞

davidrustingha commented 4 years ago

I also had the popup and when I removed my spotify entities I wasn't able to set them up again. Until I added the internal (IP) and external (duckdns) URL's to the configuration. After that it worked again!

mikalauskas commented 4 years ago

setting up _externalurl: fixed for me too

zenoVerboom commented 4 years ago

@Sholofly I'am experiencing the same problem, when updating to the new version (0.115) it asked to reconfigure spotify. When I did that from the integration menu after pressing reconfigure it popped a message "aborted" without an error, So I deleted the integration completely and reconfigured it, but if I try to add the integration and configure it, it immediately pops up a message "aborted", it doesn't show any errors in the logs, I also have installed spotcast and the spotify-card. edit: (it is not a custom component error as I disabled them all temporary without succes)

Sholofly commented 4 years ago

I also had the popup and when I removed my spotify entities I wasn't able to set them up again. Until I added the internal (IP) and external (duckdns) URL's to the configuration. After that it worked again!

Where did you configure this? I assumed it was in spotify but that was a false assumption from my side.

zenoVerboom commented 4 years ago

@Sholofly he got the answer, just put this in your configuration.yaml, it worked for me.

homeassistant: external_url: "https://www.example.com" internal_url: "http://homeassistant.local:8123"

damienlevin commented 4 years ago

@Sholofly he got the answer, just put this in your configuration.yaml, it worked for me.

homeassistant: external_url: "https://www.example.com" internal_url: "http://homeassistant.local:8123"

This also worked for me. Thanks

Sholofly commented 4 years ago

I can confirm. Works for me too. Still looks like a bug to me? At least it should be mentioned in the docs.

davidrustingha commented 4 years ago

Yes. Either in your config.yaml or via the UI under config-> general

leppa commented 4 years ago

For those still struggling even when they have internal_url and external_url set, be sure to access you HA instance using exactly the domain you have in your URL's. I have "canonical" URL for my HA which looks like hass.example.com, however I also aliased it as example.com. When I was accessing HA using example.com, I kept getting the Aborted error. But when I accessed it using hass.example.com, everything finally worked.

mwasowski commented 4 years ago

I can confirm. I had to fix my internal_url. Since I configured everything on the Spotify Dev Dashboard I've set up reverse proxy and I am using it to access my HA installation.

bohmandan commented 4 years ago

My internal and external URLs were already setup correctly. It's still showing "aborted". Nothing on the logs. I am using the correct URL, I tried to setup the integration using both internal and external URLs, same result.

Same here. Only thing to note I guess, is that my internal and external URLs is the same (I route differently using DNS). I first noticed the error, without these properties set. With them being set, not working either.

J-Lindvig commented 4 years ago

My internal and external URLs were already setup correctly. It's still showing "aborted". Nothing on the logs. I am using the correct URL, I tried to setup the integration using both internal and external URLs, same result.

I face the same issue and I all ready had states external and internal URL in my config. Pre 0.115.x no issues.

Pelado-Mat commented 4 years ago

Same issue here, no problems pre 0.115.x. but I had to add the external and internal URL to fix the problem.

abmantis commented 4 years ago

After fixing my external_url (it was pointing to an old DNS), I was able to get the integration working.

rjmidau commented 4 years ago

Internal/External URLs were not set in my instance either, and setting them resolved the vague 'Aborted' error. If these values are integral to the operation of integrations it may be worth throwing an error in the logs on start to warn that they aren't set and may cause issues with integrations, and a more descriptive warning in the integration itself?

frenck commented 4 years ago

a more descriptive warning in the integration itself?

Yes, that was created but isn't showing due to a bug. It missed 0.115.2, but we are trying to fix the error message in 0.115.3

mfabiani53 commented 4 years ago

I am having a different problem after upgrading to 0.115. I get this in integrations page:

Schermata 2020-09-27 alle 13 32 48 And clicking to reconfigure i get the request to open a web page, but opening that page i get: INVALID_CLIENT: Invalid redirect URI. BTW my spotify integration is still working as before also having this request. What happens?

whazor commented 4 years ago

I did have the urls correctly configured, but found I could only configure Spotify using the internal URL not the external URL.

trebolcinco commented 4 years ago

Same here, URL's are configured and still getting Aborted.

uSpike commented 4 years ago

This is broken for me too on Home Assistant 0.115.6. If i try to reconfigure spotify the url looks like https://accounts.spotify.com/authorize?response_type=code&client_id=[redacted]&redirect_uri=http://127.0.0.1:8123/auth/....

I have external and internal URLs configured: ha_spotify

There also seem to be some log items:

2020-10-02 23:17:38 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.spotify_jordan fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/local/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 403, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 426, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 421, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/local/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/spotify/media_player.py", line 195, in wrapper
    result = func(self, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/spotify/media_player.py", line 462, in update
    current = self._spotify.current_playback()
  File "/usr/local/lib/python3.8/site-packages/spotipy/client.py", line 1635, in current_playback
    return self._get("me/player", market=market, additional_types=additional_types)
  File "/usr/local/lib/python3.8/site-packages/spotipy/client.py", line 284, in _get
    return self._internal_call("GET", url, payload, kwargs)
  File "/usr/local/lib/python3.8/site-packages/spotipy/client.py", line 239, in _internal_call
    response = self._session.request(
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

and

2020-10-06 15:10:22 ERROR (SyncWorker_41) [spotipy.client] HTTP Error for GET to https://api.spotify.com/v1/me/player/devices returned 401 due to The access token expired
frenck commented 4 years ago

The error message containing the instructions has been fixed in Home Assistant 0.116, which is available now.

Closing up this issue. The main reported issue has been resolved. I do realize that there are some other problems reported in this issue as well, but we should not keep "collections" of issues open.

If your issue isn't resolved, and you suspect a bug, please file/open a new issue.

Thanks 👍

bcutter commented 3 years ago

Basic question: I didn´t use a Spotify dev account. The official Spotify integration automatically links to the Spotify account and creates an app for HA which is granted access to the Spotify account - everything´s working pretty flawlessly nowadays.

Anyway, some time after integrating Spotify using the UI it breaks (possibly due to "home assistant spotify " HTTP Error for GET to https://api.spotify.com/v1/me/player/devices returned 401 due to The access token expired ").

My HA instance is NOT accessable from the internet (no external_url). Is that one needed for the Spotify integration?