fondberg / spotcast

Home assistant custom component to start Spotify playback on an idle chromecast device as well as control spotify connect devices
Apache License 2.0
640 stars 94 forks source link

After trying to play some particular songs, nothing happens, and no other Spotify content can be played #397

Open pmkruyen opened 11 months ago

pmkruyen commented 11 months ago

Bug Ticket

Describe the bug

Thank you for this integration!

After clicking certain particular songs or playlists on Spotify in the mediaplayer, Spotcast crashes (?) and I am unable to select and play other songs and playlists. When I restart Home Assistant everything works again as expected. (NB. I also had this error once after I tried to play a radio station from the radio integration that was no longer available / IP address was unavailable).

Troubleshooting

Make sure to validate all the elements before submitting the ticket (Exception to the steps marked as optional)

Troubleshooting

Make sure to validate all the elements before submitting the ticket (Exception to the steps marked as optional)

[x ] Using latest version of spotcast [x ] Using latest stable version of Home Assistant [x ] I have setup the Spotify integration in Home Assistant [ x ] I have renewed my sp_dc and sp_key values and restarted Home Assistant (see README) [ x] (optional) I have Spotify Premium (optional) I am using multiple accounts (optional) I'm attaching relevant logs with level debug for component spotcast (see README) (optional) I'm using entity_id in the service call and have tried device_name but the issue remains Environment

Installation type: [HA_OS|Container|Supervised|Core] HA version: [2023.7 ]

Logs

No new error logs seem to be created after a crash.

<Logger: homeassistant.core
Source: custom_components/spotcast/spotify_controller.py:104 
Integration: Spotcast ([documentation](https://github.com/fondberg/spotcast), [issues](https://github.com/fondberg/spotcast/issues)) 
First occurred: 18:27:31 (1 occurrences) 
Last logged: 18:27:31

Error executing service: <ServiceCall spotcast.start (c:01H5Z6TV9F9R8VMM0NMTQTNM2V): entity_id=media_player.nest_mini_room, uri=spotify:track:3NFnEfVZrBP2ergaV6zibG, random_song=False, start_volume=101, limit=20, repeat=off, force_playback=False, shuffle=False, offset=0, ignore_fully_played=False>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1983, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 2013, in _execute_service
    return await self._hass.async_add_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/spotcast/__init__.py", line 221, in start_casting
    spotify_device_id = spotcast_controller.get_spotify_device_id(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/spotcast/spotcast_controller.py", line 250, in get_spotify_device_id
    spotify_cast_device.startSpotifyController(access_token, expires)
  File "/config/custom_components/spotcast/spotcast_controller.py", line 95, in startSpotifyController
    sp.launch_app()
  File "/config/custom_components/spotcast/spotify_controller.py", line 104, in launch_app
    raise LaunchError(
pychromecast.error.LaunchError: Timeout when waiting for status response from Spotify app>

Additional context

easterapps commented 11 months ago

Hi, i had a similar issue. Please check the keys (sp_key and sp_dc) and also check the app in spotify developer.

pmkruyen commented 11 months ago

Ok, thanks. Good suggestions. I will double check the app in Spotify developer. (I already renewed the key and dc.)

ste-ta commented 11 months ago

I am having the Same issues since a Couplet of days. Starting Playlists and Albums works a coupel of tmes and suddenly stops. Afterwards I need to restart HA and it works again.

Logger: homeassistant.core Source: custom_components/spotcast/spotify_controller.py:104 Integration: Spotcast (documentation, issues) First occurred: 09:33:22 (2 occurrences) Last logged: 10:00:09

Error executing service: <ServiceCall spotcast.start (c:01H6R07ZKJZEZ636C2CE6PMDP9): entity_id=media_player.lg_dsn8yg_0981, uri=spotify:album:7a0cCpsKO6Uux6eFFZns9S, repeat=off, shuffle=False, start_volume=101, force_playback=False, limit=20, offset=0, ignore_fully_played=False, random_song=False>
Error executing service: <ServiceCall spotcast.start (c:01H6R1S0SD3G5E99MT4BAJN159): entity_id=media_player.lg_dsn8yg_0981, uri=spotify:album:5BCDZehG1Ir8cokNvw6Lio, repeat=off, shuffle=False, start_volume=101, force_playback=False, limit=20, offset=0, ignore_fully_played=False, random_song=False>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1983, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 2013, in _execute_service
    return await self._hass.async_add_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/spotcast/__init__.py", line 221, in start_casting
    spotify_device_id = spotcast_controller.get_spotify_device_id(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/spotcast/spotcast_controller.py", line 250, in get_spotify_device_id
    spotify_cast_device.startSpotifyController(access_token, expires)
  File "/config/custom_components/spotcast/spotcast_controller.py", line 95, in startSpotifyController
    sp.launch_app()
  File "/config/custom_components/spotcast/spotify_controller.py", line 104, in launch_app
    raise LaunchError(
pychromecast.error.LaunchError: Timeout when waiting for status response from Spotify app
oshriphoto commented 10 months ago

It seems that this is a problem that appears to many users, does anyone have a solution to this problem? Is the developer of the plugin in the group and reading the errors? Maybe he can respond and say if it is in treatment or not?

pmkruyen commented 10 months ago

I confirm that I still have this problem.

A working hypothesis: does this happen when/after I open my Spotify account on another device confusing Spotify?