Play/Browse Spotify-Media on Sonos - A combination of sonos and spotify

Hi!

Background: The Sonos-Card/integration dies not support browsing my spotify playlists/albums/etc., only items in “My Sonos”. The Spotify Integration does support this, but does not list sonos as source.

So i want to create a combination of the sonos- and the spotify component to be able to use the Media-Browse-Button on the Sonos-Card like the one from the spotify-card. To do so, i have to use the “Browse-Media” functionality from the spotify-integration and use the selected spotify-uri in the sonos-integration.

Is there any chance to “call” the spoify-integration to get the informations and use them in my custom sonos-integration at e.g. “library_payload”?

I’ve started small tests in node-red to see if this is theoretical possible, and it is. I’m able to send any spotify-uri from my sporify-account to sonos. But if i could use existing things, i don’t have to reinvent everything :wink: Otherwise i have to create a completely new integration using node-red. I hope you know what i mean :slight_smile:

Regards, RockKeeper

Ok, I tried around a bit and actually got it to work. I can browse through my spotify media (albums, playlists, songs) on the card and play them on my sonos system :slight_smile: The trick is to get the spotify-uri’s through the spotify-integration and play them with the sonos-integration (my customized version of this)
See https://github.com/RockKeeper/homeassistant-sonos-spotify

What I’m still missing is a way to select and save spotify’s media-player-entity-id and unique-id when setting up the integration to access the spotify account configured at the sporify-integration.

Could someone give me a tip how to do so? I have already played a bit with the ConfigFlow and OptionsFlow, but without success. At this moment i have hardcoded those informations. See here and here

I know that this is not a beautiful solution, but at first it is a proof of concept and I would be very happy about your help. It will be polished, cleaned up and freed from copy-paste code when it is ready :slight_smile: