Error while setting up platform spotify, how to solve

In 0.71 (but has been for some time) I receive this error. COnfiguration is simple

media_player:

  • platform: spotify
    client_id: !secret_client_id
    client_secret: !secret_client_secret

2018-06-14 12:22:10 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform spotify
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 129, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/media_player/spotify.py”, line 82, in setup_platform
token_info = oauth.get_cached_token()
File “/usr/lib/python3.6/site-packages/spotipy/oauth2.py”, line 132, in get_cached_token
token_info = json.loads(token_info_string)
File “/usr/lib/python3.6/json/init.py”, line 354, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.6/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python3.6/json/decoder.py”, line 357, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

have you followed the step by step instructions in setting up the component listed in the page?

I would think your redirect url is wrong if you aren’t getting a response.

It was working before, I rechecked, all.

My redirect url is
http://192.168.1.12:8123/api/spotify

which is correct. I do not use https, I do use Caddy as reverse proxy

Well the error is occuring with the authorization token. When the component is setting up, it’s failing to get a response during authorization. So it is related to one of the following things:

  • client_id
  • client_secret
  • Redirect URI
  • somethings funky with your network

Check your config.
You wrote “!secret_var_name” instead of “!secret var_name”.
Notice the space after !secret.

Sebastian

in config is correct

  - platform: spotify
    client_id: !secret spotify_client_id
    client_secret: !secret spotify_client_secret