So the media-player-authorization-problem thread got me hooked on this plugin and I decided to give it a try, but I ran into some troubles. I don’t want to derail that thread, at least before that problem is solved, so I am asking in a new thread instead, hope that’s ok.
Installation looks ok I think. On the first run I got the configuration box and connected to the spotify site to confirm my identity, and .spotify-token-cache
is created in the config dir (/home/homeassistant/.homeassistant), but no new media player shows up in https://<mydomain>:8123/dev-state
and I get the following messages in the log:
Apr 12 19:03:50 razberry hass[20731]: 17-04-12 19:03:50 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.spotify
Apr 12 19:03:50 razberry hass[20731]: 17-04-12 19:03:50 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Apr 12 19:03:50 razberry hass[20731]: Traceback (most recent call last):
Apr 12 19:03:50 razberry hass[20731]: File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
Apr 12 19:03:50 razberry hass[20731]: result = coro.throw(exc)
Apr 12 19:03:50 razberry hass[20731]: File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 359, in async_process_entity
Apr 12 19:03:50 razberry hass[20731]: new_entity, self, update_before_add=update_before_add
Apr 12 19:03:50 razberry hass[20731]: File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 189, in async_add_entity
Apr 12 19:03:50 razberry hass[20731]: yield from self.hass.loop.run_in_executor(None, entity.update)
Apr 12 19:03:50 razberry hass[20731]: File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
Apr 12 19:03:50 razberry hass[20731]: yield self # This tells Task to wait for completion.
Apr 12 19:03:50 razberry hass[20731]: File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
Apr 12 19:03:50 razberry hass[20731]: value = future.result()
Apr 12 19:03:50 razberry hass[20731]: File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
Apr 12 19:03:50 razberry hass[20731]: raise self._exception
Apr 12 19:03:50 razberry hass[20731]: File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
Apr 12 19:03:50 razberry hass[20731]: result = self.fn(*self.args, **self.kwargs)
Apr 12 19:03:50 razberry hass[20731]: File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/media_player/spotify.py", line 153, in update
Apr 12 19:03:50 razberry hass[20731]: current = self._player.current_playback()
Apr 12 19:03:50 razberry hass[20731]: AttributeError: 'Spotify' object has no attribute 'current_playback'
###my installation steps
####spotify.py
As for the installation I hope I got it right, I cloned home-assistant and checked out the pr#6980
The hash that I’m using for home-assistant/pr#6980: ff8c226e6271d33f7a2d542ee50b0cfe3e964fad
I made a soft link to the spotify.py in the git repo:
ln -s /srv/homeassistant/src/home-assistant/homeassistant/components/media_player/spotify.py /srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/media_player/
####spotipy.py
After that I activated my virtual environment and installed spotipy from @happyleaves fork
(happyleavesaoc/spotipy: 7499d8e511ce3f5588a16702c9533233ec716cab)
git clone https://github.com/happyleavesaoc/spotipy.git
source /srv/homeassistant/bin/activate
cd spotipy/
python setup.py install
####api
As for the spotify API I created a new app and set the redirect uri to https://<mydomain>:8123/api/spotify
Not sure if this is the way to go, but https://:8123 is the way I connect to home-assistant both outside and inside my network.
####config
for the media player config, all I am using is this (with keys in my secrets files)
- platform: spotify
client_id: !secret spotify_client_id
client_secret: !secret spotify_client_secret
Not sure where to go from here. Suggestions?