Spotcast - custom component to start playback on an idle chromecast device

Hello, @fondberg and thanks a lot for this great component. So far it was really good apart from one thing that drives me crazy.

Regularly for some unknown reason the playback goes on pause. Literally with out doing anything it just goes on pause after 20-25 minutes.

Is there anything i can do to fix this? maybe something in the settings?

If you need any specific details for my setup or my configuration please let me know.

thank you.

Before it worked perfectly, but now it dont work.
I receive the message: spotcast Could not find device with name

Log in Homeassistant:

Known devices: []
23:24:20 – Start Spotify on chromecast (ERROR)
No device with id "a277e2bf1f1f19679a28d6835b63c308" known by Spotify
23:24:20 – Start Spotify on chromecast (ERROR)

I get the same as you today.
It worked yesterday.
Log:

2021-03-23 09:13:06 ERROR (SyncWorker_4) [custom_components.spotcast] No device with id "anonymized" known by Spotify
2021-03-23 09:13:06 ERROR (SyncWorker_4) [custom_components.spotcast] Known devices: []

Hi,
Trying to get Spotcast to work with both a Nest mini and connected devices. All devices used are listed in my Spotify account.
Spotify integration is working fine.
In configuration.yaml the values for sp_dc and sp_key are set.
Whenever I try to use a connected device, like this:

service: spotcast.start
data: {
	spotify_device_id: Echo_dot
	uri: spotify:playlist:7Hz88Y0IMn1QqqolgpO2JT
	random_song: true
}

I get this error in the log: [139620996543632] http status: 404, code:-1 - https://api.spotify.com/v1/me/player/play?device_id=Echo_dot: Device not found, reason: None

When I try to use a Chromecast device (Nest mini) like this:

service: spotcast.start
data:
  entity_id: media_player.woonkamer_speaker
  uri: 'spotify:playlist:7Hz88Y0IMn1QqqolgpO2JT'
  random_song: true

I get an error: [139620993471440] Failed to get device id from Spotify. Funny thing is that when the Nest mini is not idle it starts playing anyway. When idle, nothing happens.
I’m using a Facebook login for Spotify and connected HA with Spotify using the unique username and password. Have tried cookie values when logged in with Facebook and with unique username.

Hope someone can help me with this

the same as above:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/spotcast/__init__.py:478
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 22 marca 2021, 22:52:14 (16 occurrences)
Last logged: 10:39:58

* [XXXXXXXXXXXX] Failed to get device id from Spotify

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 141, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1488, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1527, in _execute_service await self._hass.async_add_executor_job(handler.job.target, service_call) 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/spotcast/__init__.py", line 296, in start_casting spotify_device_id = spotify_cast_device.getSpotifyDeviceId(client) File "/config/custom_components/spotcast/__init__.py", line 478, in getSpotifyDeviceId raise HomeAssistantError("Failed to get device id from Spotify") homeassistant.exceptions.HomeAssistantError: Failed to get device id from Spotify


Logger: custom_components.spotcast
Source: custom_components/spotcast/__init__.py:477
Integration: Start Spotify on chromecast ([documentation](https://github.com/fondberg/spotcast))
First occurred: 22 marca 2021, 22:52:14 (17 occurrences)
Last logged: 10:39:58

Known devices: []

The same problem

Same Problem, out of nowhere none of my spotcast things work.

Have tried replacing entity_id with device_name
Still shows error:
2021-03-24 08:00:02 ERROR (SyncWorker_8) [custom_components.spotcast] No device with id "33fa00a66f2edf0d1c5697a9f8693ba8" known by Spotify 2021-03-24 08:00:02 ERROR (SyncWorker_8) [custom_components.spotcast] Known devices: []
This is WITH EITHER ENTITY_ID OR DEVICE_NAME
I have removed and readded the spotify integration, removed and readded devices, created new sp_dc and sp_key cookies, and created a new secret for the dev app.

When already playing a song via spotify the integration is able to control, but not change speaker output, when attempting to move speakers(even selecting the one currently on and in use) is met with the same error as above.

Let me know if any other testing should be done.
Thanks

I also have the same problem. Since yesterday that I have the same error with this integration.
Can I help debugging it?

Thanks,

Hi everyone,
Same here, Spotcast was working fine for months, and since a few days I get the error : “failed to get device id from spotify”.
Any ideas please ?
Thanks :slight_smile:

Issue can be tracked on Github Failed to get device id from spotify · Issue #170 · fondberg/spotcast (github.com) including a dirty fix

3 Likes

thanks, dirty trick makes it work again :ok_hand:

Can you please share the full __init.py file with the dirty fix? I was not able to change the original one…
Thanks in advance…

I believe you already got the file via the Github thread, correct?

Yes, correct… thanks anyway…

I just updated to new HA version I get a different error

Logger: homeassistant.components.hassio
Source: components/hassio/init.py:486
Integration: Home Assistant Supervisor (documentation, issues)
First occurred: 9:13:20 (1 occurrences)
Last logged: 9:13:20

Component error: spotcast - cannot import name ‘KNOWN_CHROMECAST_INFO_KEY’ from ‘homeassistant.components.cast.media_player’ (/usr/src/homeassistant/homeassistant/components/cast/media_player.py)

2 Likes

Same here with me. Updated to 2021.4.0

Setup failed for spotcast: Unable to import component: cannot import name ‘KNOWN_CHROMECAST_INFO_KEY’ from ‘homeassistant.components.cast.media_player’ (/usr/src/homeassistant/homeassistant/components/cast/media_player.py)

Tried to find Spotcast in HACS to see if can reinstall but could not locate Spotcast nor it would allow me to add the repository saying it is already in the catalog.

2 Likes

I’m also seeing this exact same issue. I’ve tried uninstalling, reinstalling, etc.

It prevents HA from being restarted.

2 Likes

same for me…

same issue here.

Pychromecast has been updated to 9.0 with latest HA according to the changelog. Since spotcast depends on that, perhaps it needs to be updated too. https://github.com/home-assistant/core/pull/47086

I don’t use spotcast anymore, so I’m not of any help, but wanted to drop this information.