Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Spotify' object has no attribute 'playlist' #6

Closed
pergolafabio opened this issue Feb 10, 2020 · 14 comments · May be fixed by #7
Closed

Spotify' object has no attribute 'playlist' #6

pergolafabio opened this issue Feb 10, 2020 · 14 comments · May be fixed by #7

Comments

@pergolafabio
Copy link

pergolafabio commented Feb 10, 2020

Hi, since Home assistant uses the new spotify integration from 105.x, this custom component in combination with the offcial component is giving erros below when a playlist is playing

according to Frenck, this custom is the cause : home-assistant/core#31582 (comment)

i dont know the root cause, but you can see the conversation from here
can you fix it in this component?
much appreciated! @dnguyen800

2020-02-07 11:29:48 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.spotify fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/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 83, in wrapper
    result = func(self, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/spotify/media_player.py", line 338, in update
    self._playlist = self._spotify.playlist(current["context"]["uri"])
AttributeError: 'Spotify' object has no attribute 'playlist'
@dnguyen800
Copy link
Owner

thanks for letting me know. Unfortunately I no longer have free time to work on this, but hopefully I can take a look at it later this month.

@pergolafabio
Copy link
Author

Ok, no problem... The sensor actually works, it's just that the log file is flooding with those messages when not idle ;)

@pergolafabio
Copy link
Author

note:

i uninstalled this custom, then did a rebuild/upgrade to newer hassio version
if you then install this cusom again, the original media_player.spotify (official integration) goes to an unavailble state ...

@dnguyen800
Copy link
Owner

i guess the sensor is broken in the latest HA version then. I may attempt a rewrite but unfortunately I don't program much anymore, so this is a low priority. Would suggest https://github.com/custom-cards/spotify-card if you want a working card.

@pergolafabio
Copy link
Author

Yes using that one as a workaround now , but I liked your more, that other one always refreshed the webinterface when authentication is needed...

There is no easy fix for your card?

@pergolafabio
Copy link
Author

i saw you updated: Spotify Playlist Card

it doenst resolve this issue right?

@pergolafabio
Copy link
Author

hi @dnguyen800

still no time to make the fix? or can you tell me the lines of codes i need to change? can you point me into right direction? really liked this sensor, so playlist would be loaded native

with this one : https://github.com/custom-cards/spotify-card

you always need to reauthenticate after an hour

@dnguyen800
Copy link
Owner

sorry, doesn't look like i'll have time to fix it. I would like to do a complete rewrite but forgot most of my programming skills already.

@pergolafabio
Copy link
Author

pergolafabio commented Mar 30, 2020

oh, thats too bad :(

i also see now this error.. i tried changing your manifest, so it loads spotify 2.7.1 instead of spotipy-homeassistant==2.4.4.dev1
but didnt help either :-)

@Seafo
Copy link

Seafo commented Mar 30, 2020

Thank you dnguyen800 for creating this card in the first place!
Hopefully someone else will continue the development. Personally I have stopped updating HA since v. 104 only to be able to continue using this card. There are no good substitution yet according to me.

@pergolafabio
Copy link
Author

indeed , i like this sensor / card a lot, since its native

@pergolafabio
Copy link
Author

ok, its fixed, i just changed in sensor.py file and manifest the spotipy version to

spotipy==2.7.1

now i dont receive the errors anymore

@Trouble-51
Copy link

since the introduction of internal and external URL's in config the spotify-sensor file gives the following error message:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/spotify-playlist-sensor/sensor.py", line 88, in setup_platform
callback_url = '{}{}'.format(hass.config.api.base_url, AUTH_CALLBACK_PATH)
AttributeError: 'ApiConfig' object has no attribute 'base_url'

I don't know how difficult this/time consuming this is, but could you please update this file and substitute base_url with the new requirements? This would be very much appreciated!

Thanks so much

@Electronlibre2012
Copy link

Hello,

nobody to continue the development?

This component is great...

Sadly my programming skill is bad...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants