I didn’t get it to work with uri: ‘spotify:playlist:2OMDoS3EeIbJ2omad64QeL’, when i i uses the whole URL from spotify i got it to work.
Like this: uri: ‘https://open.spotify.com/playlist/5UUo28NbRH0xsCa3XS2Q’
Maybe you could try that?
I didn’t get it to work with uri: ‘spotify:playlist:2OMDoS3EeIbJ2omad64QeL’, when i i uses the whole URL from spotify i got it to work.
Like this: uri: ‘https://open.spotify.com/playlist/5UUo28NbRH0xsCa3XS2Q’
Maybe you could try that?
Same problem. I used the following now:
service: spotcast.start
data:
uri: 'https://open.spotify.com/playlist/2OMDoS3EeIbJ2omad64QeL'
random_song: true
shuffle: true
device_name: Google Kantoor
I even deleted the script and recreated it just now but the error remains. Also tried with any of the other Google Home devices that I have and the error is the same.
When I try to address these devices with the script in this post, it works flawlessly:
Awesome! Glad you got it working.
What is the current error message? If it’s related to device_name:
I’ve noticed the device_name needs to be spelled 100% correctly including uppercase/lowercase etc.
So might be wise to verify that.
I also had the stumbling block of the device name and entity I’d not working.
What I found in my case is that the device name isn’t necessarily correct in HA. I had to open the (google) Home app on my phone and use the name listed in there before I could get this to work.
I renamed my chromecast in the home app then restarted HA and it worked after that.
Brilliant! That did the trick. I had renamed the Google device in HA but it was called ‘Kantoor’ in the Google app. Working like a charm now. Much appreciated Dan,
Hi all
I just installed spotify integration and the spotcast component which is super helpful
Thanks!
I have one problem though. I can start the spotcast service from a script but after 50-60 minutes the chromecast turns off by itself. Is there something I can do?
Another issue not related to spotcast is that I don’t know how I could move to the next song of a playlist. Is there a way?
Thanks. I see that there is no solution for this. Is this happening to all users? (I guess yes)
Yes it happens to us all
Maybe I should write a script… if chromecast stop turn it on… I must think of a condition though…
I was always wondering if one might be able to create an on the fly scene, stop Spotify, then activate the scene again. Perhaps you can find out?
I tried to make a scene or a start the service cast but it is not working. What is needed is too choose the media player from the lovelace card but I don’t know if this is possible or how to do it.
At least in my case when the spotcast stops all I have to do is to choose the chromecast player from the picture below.
This used to work for me, but now I’m getting this error when calling the service:
‘ChromecastInfo’ object has no attribute ‘services’
Any idea what might be causing this? Since it wasn’t working I updated the cookies in my secrets.yaml to be current, but still received the same error.
Maybe post your code?
I think Spotify and Google Cast are having some issues btw. Having issues streaming since yesterday. Also Google Home to Spotify directly had issues, so can’t be spotcast/HA itself.
Replaced tokens twice (log mentioned expired tokens first). After a while suddenly worked (but sometimes hiccups when skipping songs). Now again issues, also from Google Home > Spotify directly.
Logger: homeassistant.core
Source: custom_components/spotcast/__init__.py:452
First occurred: 11:01:13 (2 occurrences)
Last logged: 11:03:05
Error executing service: <ServiceCall spotcast.start (c:48e40fd4105711eba8212755870ff66b): entity_id=media_player.multispeakers_cast, uri=spotify:playlist:37i9dQZEVXcQorVlmdOh35, random_song=True, shuffle=True, force_playback=False, repeat=true, offset=0>
Error executing service: <ServiceCall spotcast.start (c:8b36271a105711eba646ef90cbb687b4): entity_id=media_player.multispeakers_cast, random_song=True, repeat=playlist, force_playback=True, offset=0, shuffle=False>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 1351, in catch_exceptions
await coro_or_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1374, in _execute_service
await self._hass.async_add_executor_job(handler.func, 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 302, in start_casting
spotify_cast_device.startSpotifyController(access_token, expires)
File "/config/custom_components/spotcast/__init__.py", line 452, in startSpotifyController
sp.launch_app()
File "/usr/local/lib/python3.8/site-packages/pychromecast/controllers/spotify.py", line 88, in launch_app
raise LaunchError(
pychromecast.error.LaunchError: Timeout when waiting for status response from Spotify app
@fondberg do you perhaps have the same experience?
Edit: also trying to cast from Spotify app to Chromecast speakers (thirdy party and Google mini’s) have issues. Either my network is messed up, or Spotify > Google Cast is having issues. Spotify Connect works fine.
Edit 2: casting other sources like online radio streams to Google Cast speakers works fine.
Edit 3: seems a widespread issue: https://community.spotify.com/t5/Android/Spotify-and-Nest-Mini-can-t-cast-or-play-on-device/td-p/5054694
I figured I’d share all this info and findings so others know Google Cast is having issues, not spotcast.
I just wanted to say thanks for this great component! I’ve been using Spotcast in combination with room presence detection to have my Spotify music follow me around my home. I’ve written a guide on how to get it set up if anyone else is interested.
I love the ability to transfer playback! Am I correct in assuming that while this component supports spotify connect devices, it does not support sonos speakers as spotify connect devices?
(I’d like to be able to transfer playback from my phone to my sonos when arriving home.)
I believe spotcast uses the officiel Spotify integration to play on Spotify Connect speakers. The official integration indeed does not support Sonos speakers.
Perhaps spotcast uses it’s own method to cast to Spotify Connect, but that’s unlikely. So if you have tested this and it does not work, this is the reason.
If I have understood correctly, spotcast does not use the official Spotify integration to start playback, but rather uses it’s own method with tokens/cookies from the browser login. That is why it’s able to start playback on devices you initially don’t see in the official Spotify integration. So in theory you can start playback with spotcast without involving the official Spotify integration at all. But you will still need it for controlling the playback afterwards.
Unfortunately you are correct, even with this method it does not support Sonos speakers. It was mentioned in the documentation on GitHub when Spotify Connect support was introduced to spotcast.
I had 2 Sonos speakers for testing but I was not able to automate them as advanced as I wanted with multiple Spotify account simultaneously. I also had an older Spotify Connect speaker which I didn’t have much luck with, even when using spotcast.
So to make it easy for myself I dumped those and now have 14 Cast devices instead (12x JBL Link Music, 1x Google Nest Hub, 1x Google Nest Mini), and now I can do everything I want with the help of this awesome component.
I meant Spotcast uses probably uses the Spotify integration for only the Spotify Connect casting. To cast to Chromecast it uses its own implementation (indeed of scraping the tokens through web player). Perhaps it uses that same implementation to cast to Spotify Connect speakers, but if that was the case you would think you could also cast to Sonos (if their also listed through web).
I think if you want automate music when using Sonos, you should see what the Sonos component has to offer with playback options. It is possible sinds HA 117 to play Spotify URI’s directly on Sonos (kinda like how Spotcast works):
- @amelchio also added support for playing Spotify URIs with the Sonos integration.