I installed newest version spotify.py from PR and player appears after restart HA.
Yes, I think so. How do you get Spotify into a non-paused/playing state?
Strange, today morning media player appeared after HA restart when no player was active, now not appears after restart.
Is your cache file still there? Is there any error in the log?
After a HA restart Iâm now getting the same log error as @Bieniu, the volume calculation error. As a result, the player doesnât show up anymore.
Yes, everything is in place. Sometimes when I restarted HA with all Spotify players off media_player donât appears. But only sometimes. In this cases in log there are errors about volume. When media_player appears everything is working but I have this error:
17-04-11 20:39:06 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.spotify is taking over 10 seconds.
17-04-11 20:39:06 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.spotify fails
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
None, self.update)
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/media_player/spotify.py", line 153, in update
current = self._player.current_playback()
File "/home/homeassistant/.homeassistant/deps/spotipy/client.py", line 856, in current_playback
return self._get("me/player", market = market)
File "/home/homeassistant/.homeassistant/deps/spotipy/client.py", line 148, in _get
return self._internal_call('GET', url, payload, kwargs)
File "/home/homeassistant/.homeassistant/deps/spotipy/client.py", line 125, in _internal_call
-1, '%s:\n %s' % (r.url, r.json()['error']['message']),
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/models.py", line 866, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.4/json/__init__.py", line 318, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.4/json/decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode
raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)
When I restarted HA with Spotify player on there is no errors.
Wow, I hadnât heard about this plugin before and it sounds like something I may need to try out.
I donât want to derail the thread but I got to ask if I got it right; can you use this to start any spotify uri (like spotify:user:spotify:playlist:4BKT5olNFqLB1FAa8OtC8k) on any compatible spotify device in the network? Chromecasts etc?
If so I am definitely going to test it tomorrow.
@chrio If your chromecast shows up in Spotify Connect, then yes (mine doesnât ⌠on my Fire TV, Echo dot, etc)
I pushed an update that hopefully should address the idle/volume issue.
Thanks for this awesome component. Looks like something i can make use for my echo dots.
May i know can it work without exposing my HA to the internet?
It wonât work without an internet-facing endpoint, unless you manually complete the authorization process. You can find examples in the spotipy
documentation.
For me it worked just fine without. As long as the browser you use to âConfigureâ has access to your HA preferably (which it has since you can press the Configure button )
I see what youâre saying - I guess the Spotify authorization process does a client-side (browser) HTTP GET to the Home Assistant authorization endpoint?
I notice the component is sometimes being rate-limited by Spotify. But they donât disclose what the rate limit is. Seems like the default 10-second update
is a bit too much though.
Itâs oAuth so yes
In regards to the API calls, I did notice a massive graph so you might want to make it 30s instead?
@happyleaves I installed today the latest version of spotify.py and there are no errors in the log anymore. Good job.
The only thing that doesnât work is the source selection. I have a Denon receiver that works with Spotify Connect. The Spotify apps on the phone or on the desktop sees Denon independently whether it is on or in standby mode and whether the output is selected. Your component doesnât see Denon until it starts playing music with Spotify. As the receiver switches to another source or switch to standby mode, it will disappear from your component. Can I somehow force the component to have a receiver on the list all the time?
@syphernl Youâre right about oauth. I didnât know that. I will revise the doc. I made the update interval 30 secs as well.
@Bieniu The device list was only updating when something was playing or paused. I made it update every time. Try the latest version and see if that helps your problem.
I plan to give the go-ahead for merging on this shortly unless there are any other breaking problems.
Itâs better now because the component detects my AndroidTV box exactly as it does Spotify desktop application. Unfortunately, the Denon receiver is still not detected until I start playing on it. On a screenshot, compare what Spotify detects with what your component detects.
I think the component is ready to merge with HA. Major issues no longer exist and it works stably. Thank You for greate work!
Sorry, could you provide a few steps on how to install this for someone new to HASS please?
@Bieniu the component uses exactly what it gets back from the public Spotify API. Maybe the desktop application caches devices, like the Denon? We could do the same thing, possibly. Thanks for testing and feedback!
@getsmokes if youâre familiar with git & github, you can drop the spotify component file from the branch into your home assistant install. If youâre not, just wait a week for HASS 0.43, which should have this component by default.