My gut feeling tells me it’s either Spotify themselves that block casting to groups or spotipy that’s the culprit here. I made a simple librespot/icecast/liquidsoap docker container and casting the broadcast url to groups with pychromecast using blocking mode works. (latest github version).
Maybe you are right but it would be interesting to trace the traffic when starting casting from chrome. I don’t have time now but if someone traces I can add the functionality in relevant libs (spotipy or pychromecast)
Hi @fondberg, first of all big thanks for this wonderful custom component, it works amazingly well in combination with the spotify-card
Would it somehow be possible to create multiple instances with different Spotify accounts for each instance?
I created different lovelace spotify-cards for my family members, each with a different Spotify client-id.
However each card starts playing from my Spotify account if I select a (spotcast) source in the card.
Just wondering
Thanks! It would be quite simple if we agree on a way to send some identifier in the call to the service. The components configuration would.of course also need to be changed to be able to take multiple account username/password pairs. Can you think of a way to add this without breaking backwards compatability?
To get rid of any misconceptions; this component only supports the new style of declaring dependencies (introduced in 0.92) using the manifest.json. Not the old way which declared the dependencies in a field called REQUIREMENTS in the actual python file.
Thanks @fondberg for the multi-account update! That was super quick
Unfortunately the component still plays everything from the main account.
I don’t get any API errors for the extra attribute “account”, so that part works.
Could the typos (see below) maybe ended up in the code too?
Multiple accounts
Add accounts dict to the configuration and populate with a list of accounts to be able to initiate playback using diffferent accounts than the default.
Weird because it worked for me. What typos are you referring to?
Regarding the spotify card I can add a config parameter to tell it to use an account to start playback in an idle chromecast device if that is what you need
username: !secret spotify_primary_password (this should be spotify_primary_username)
and:
username: !secret spotify_niklas_password (this should be spotify_niklas_username)
and:
username: !secret spotify_ming_password (this should be spotify_ming_username)
It would be awesome to have different spotify-cards on each family member page, showing the playlists of that member’s account. And when you click on a playlist in that card, it plays with the corresponding spotify account. That way each family member has his/her own spotify page in HA. Something like that
Hope I made things a little more clear, if it’s too much work don’t bother.
PS. I need to login with Anneke’s account in Windows to be able to show her spotify-card.
Another theory regarding groups would be the way SpotifyController in pychromecast handles launching of the app (or app id) on multiple chromecasts. I’ve been looking into this a little bit. But Im far from comfortable with python. It would be nice if you could first off see what app id is launched when you start casting from the Spotify app on your phone. Might be a different one than CC32E753? Are there any debugging tools for chromecast? The official one only seems to let you debug your own chromecast applications?
After some testing with the spotify example on pychromecast github I noticed that it “sometimes” launches the app on one device in the group. Starting a cast to a to a group device_id that’s already known by Spotify also works (ofc).
I’ve tried snooping a bit with wireshark but didnt really find anything useful here yet.
I think I’ll have to withdraw my statement that Spotify blocks casting to groups.
@QkulleQ I see, I still don’t understand if it is on the same device the tabs are to be clicked or on different devices. If you want the users to use the same browser on the same device I think it will be difficult because of shared cookies et.c.
edited: found the bug. pushed the change, can you test?
Sorry @fondberg, it’s still playing from my account only.
I reinstalled the component and tried 2 different accounts, but they are both playing with my spotify account after the service call.
Because you mentioned cookies I also tried it from the different Windows accounts of my relatives, where the official spotify app is connected to their accounts. Same thing,
About the ‘member tabs with spotify-cards’, I wouldn’t mind if the tab is only working when the member is logged on his/her own device or windows account.
Of course it would be preferable if it would work regardless of the device or account, but if that’s technically not possible no big deal.
Several cards have hard time co-existing in the same browser session on the same device
It is not possible, yet, to initiate playback from another account than the default account.
But with that said it would be good to test it before implementing functionality for initiating playback on a non-default account