Spotify Lovelace Card

don’t quote me but you but you may want to install " Home Panel" …Uses a customisable and themeable card based UI which can be used on a touch screen.

Spotcast only starts Spotify on Google Cast devices.

unfortunately, I have a problem, it refreshes all the time, cannot connect and cannot find gaming devices, what will I do wrong ??

Really love this card, we use it daily from our HA tablet dashboard on the wall. Thanks for your time for making it @fondberg and anyone contributed to this card.

There is a issue with Spotify Lovelace Card with new 2120.12.0 release of HA.
I am not in hurry or anything, just giving heads up:

I made the changes proposed in the link (Fixes for 2021.12.0 by hmmbob · Pull Request #271 · fondberg/spotcast · GitHub) with the Editor and everything works again.
Hopefully, the developer will publish a new version with the changes too. But so far it works!

I’ve got the Sonos ID’s finally working.

Not from within the debug of Spoticast but via the Sonos webplayer and Google Chrome developer options.

Let me explain:

  1. With google Chrome go to https://open.spotify.com/ and login with your spotify account
  2. Select developer options (CTRL+SHIFT+i) and go to the Network tab
  3. Open Spotify on your Smartphone.
  4. Play and cast a song to the Sonos speaker
  5. In open.spotify.com you can see that you are listening on the selected Sonos device.
  6. Press PAUSE
  7. Look in the developer options in the network tab for a long name, select this one
  8. Now you see a request URL in this URL you can find the device ID from this Sonos speaker

it looks like this:

https://gew1-spclient.spotify.com/connect-state/v1/player/command/from/[WEB SPOTIFY DEVICE ID/to/[SONOS SPOTIFY DEVICE ID]

The last ID is the ID you are looking for.

3 Likes

Man, I almost love you for that. :joy:

Actually I do! it works. Man, brilliant mind. Thanks for figuring it out.
This is a brand new game change here.

EDIT: It didn’t work at first but it was my yaml code that was wrong.

It worked for me. popup and sonos works with device ID found with method described by @FalconHeavy

Hmm stopped working after i started playing another source on Sonos.

To get it back working, i needed to start casting from web/smartphone to the Sonos devices and after that the control from the Spotify card within home assistant started working again with the already known device ID’s.

Guys, is there somewhay to play spotify zo a zone?
my denon receiver have 3 zones, but in spotify its always recognized as one device

so i always now need to start on the the receiver, and then turn on zone 1 or 2 , and then turn off the main zone, so it keeps playing on the other zone :slight_smile:

Can someone please help?

The card is not showing to me

I have spotcast working but the card is not showing


image

If I enter the config of the card that I had before I get this

And the link returns as INVALID_CLIENT: Failed to get client

In my mobile phone in the HA app its working but not in the desktop

I’m new here. So not sure. Have you tried installing card via HACS?

Nice work on this card. Great job, also on spotcast. This was the missing link for me.

I have a feature request: an user input option of how many songs to play, or how many minutes.
E.g. i trigger this through an automation when my kids need to go to bed. I have the google speakers announce it’s bedtime (and set lights etc) and sing a bedtime song to them. No need to play more than 1 or 2 songs from URI playlist.

1 Like

experienced the same. if the sonos device you stream to is linked on spotify from your phone it works. if you stream to another device it stops so unfortunately not a stable solution. Its a feature i know many are missing.

Question to the experts: my card works well, but it keeps reloading itself in the interface every few seconds. That makes the playlist covers disappear shortly and then reappear, which is visually annoying.

Is that normal? Is that necessary? Or is that something with my setup?

It is posible to add to this card “search” field to search song and then play?

3 Likes

Hi,

After last update this card is not working. Before worked good. What is the problem?
screenshot2022.02.04-13_14_09

What do your logs say?

(Works fine for me by the way)

Ok, now see this in the log. Maybe the spotcast is the problem, don’t know why and what.

Traceback (most recent call last):
  File "/config/custom_components/spotcast/spotcast_controller.py", line 143, in get_spotify_token
    self._access_token, self._token_expires = st.start_session(
  File "/usr/local/lib/python3.9/site-packages/spotify_token.py", line 18, in start_session
    response = session.get("https://open.spotify.com/get_access_token?reason=transport&productType=web_player",
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 667, in send
    history = [resp for resp in gen]
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 667, in <listcomp>
    history = [resp for resp in gen]
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 166, in resolve_redirects
    raise TooManyRedirects('Exceeded {} redirects.'.format(self.max_redirects), response=resp)
requests.exceptions.TooManyRedirects: Exceeded 30 redirects.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/spotcast/helpers.py", line 80, in run
    return await loop.run_in_executor(executor, pfunc)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/spotcast/__init__.py", line 96, in get_devices
    client = spotcast_controller.get_spotify_client(account)
  File "/config/custom_components/spotcast/spotcast_controller.py", line 177, in get_spotify_client
    return spotipy.Spotify(auth=self.get_token_instance(account).access_token)
  File "/config/custom_components/spotcast/spotcast_controller.py", line 137, in access_token
    self.ensure_token_valid()
  File "/config/custom_components/spotcast/spotcast_controller.py", line 133, in ensure_token_valid
    self.get_spotify_token()
  File "/config/custom_components/spotcast/spotcast_controller.py", line 149, in get_spotify_token
    raise HomeAssistantError("Could not get spotify token")
homeassistant.exceptions.HomeAssistantError: Could not get spotify token