Mycroft + Spotify + Sonos

Hi, related to this issue.

I want that Mycroft (Spotify) use per Default my Sonos Speaker. I can choose the Speaker out of the Spotify app. I am unable to say mycroft which Speaker he should use.
How can I do that?

I think what you want will eventually be released as part of the Mark-2 release.

It is work in progress.

Spotify is sort of done / available. No clue if they started working on Sonos. Just bought one today, so also interested. I know there is already a skill to control them, but I believe that one doesn’t include using it as default output.

It’s specific to Sonos.
I want to tell Mycroft please use as default the following Spotify Connect Device.

Yeah, well that part is not yet made. Or at least not that I know of, but I am not an official Mycroft Team member.

I am working on that type of functionality for my own MycroftOS project, using different output services tight into Pulseaudio. Then the last bit is to have a proper Pulseaudio control skill, where you can use voice to list sinks. Choose one or more (combine sinks).

I believe pulseaudio-dlna sink also picks up Chromecast and Sonos nowadays, but haven’t digged into it yet.

Hey Lukas,

I didn’t realise, but this seems to exist already. I’ve never used it so results may vary…

You should be able to get a list of available devices by saying something like:

What Spotify devices are available?

Then switch devices with something like:

Spotify to kitchen

I’d be interested to know how they works for you, and also what phrases you tried previously? Would be great to add these into the Skill as standard vocabulary.

OK, also did some testing with the spotify skill and my brand new IKEA Sonos Symfonisk speaker.

First of all, I am running spotifyd instead of raspotify, however both rely on the underlying Librespot library.

  • Installed spotifyd
  • Configured my spotify credentials with it
  • Installed spotify skill
  • oAuth-ed the skill via the connect button
  • Had to fill something in the user/passwd of the skill settings otherwise the skill error’s out. (you can fill in whatever you want, it is not used)

If I ask Mycroft what devices are available, it only finds the local playback device of spotifyd.
If i open spotify on a phone, it will also be found (My Poco F1).
Even a other phone outside of the network is found if that opens the spotify app (A70)

But for whatever reason, it is not picking op the Sonos that is hooked up into the same network.

Screenshot below;

If I install @fortwally his Sonos skill, I am able to control my Sonos speaker with all the commands it supports.

So I believe Sonos is doing some things differently…

Ah, right hang on. Just discovered this in the manual;

Control Sonos from your Spotify app
You can always play Spotify from the Sonos app. Now you can control Sonos directly from your Spotify app too (Spotify premium subscribers only).

While you’re listening to music in the Spotify app, select DEVICES AVAILABLE to connect to a Sonos room or room group. To use this feature you need to have a Sonos account. If you don’t have one, choose one of the following options:
• On a mobile device, go to Settings -> Advanced Settings and choose Control Sonos from Spotify.
• On a PC, go to Manage -> Settings and choose Advanced. From the Music Sources tab, choose
Control Sonos from Spotify.
• On a Mac, go to Sonos -> Preferences and select Advanced. From the Music Sources tab, choose
Control Sonos from Spotify.

Not at home now, so can’t test it yet. But then again, can’t recall seeing that option within the settings menu. I am a geek, so went through everything while setting up the speaker…

Will report back after a few hours when I am back home.

I’m looking forward to seeing the results.

Let us know, overall, how painful the setup was and what you’d like for us to do better.

No pain, what so ever so far configuring spotifyd nor the spotify skill.

If @forslund can also support spotifyd at some point it would be great. But I will pass on that message on the proper github repo.

@home, checked and there is indeed a setting to “allow remote control” however whatever you do. Sonos is not visible for Mycroft/Spotify.

Turning it on, makes the Sonos available within the Spotify app on the phone though.

So confirmed: Sonos is not controllable from within the Spotify skill. Perhaps some of Mycroft it’s finacial resources should be used to get @forslund a Sonos speaker. :wink: :smiley:

Can mycroft detect the device after you’ve started playing on it with your phone? if that’s the case it’s likely that the device is in discovery mode. (detectable over the network using zeroconfig)

If that’s so I have half of the solution, detecting the devices. After that credentials need to be encrypded in the correct way and transmitted to the device.

No, not at all.

If I play from spotify on the phone to the Sonos device, mycroft lists the local device and my phone.
If I use the Sonos app on my phone to play from spotify, mycroft only lists the local device.

I believe you use the Spotify API via spotipy to get the devices right? Perhaps, bumping the version of spotipy as the hard coded version of 2.4.4 is rather old…(2017)

EDIT: Just bumped the spotipy package to 2.6.1 however same results.

BTW: My mycroft device is listed within the app on the phone as “spotify connect”, the Sonos speaker doesn’t have this and is listed as the location I have it attached to within the Sonos app. In my case “livingroom”.

EDIT2: I start to believe that, to have Sonos support within the spotify skill you really need to use the soco python libs to get the zones from Sonos and merge that list with the spotify devices list.

Have a look at the last post here; https://github.com/SoCo/SoCo/issues/411

You know Python WAY better than I do, so you know how to convert the fixed search for “CrewRoom” into adding all discovered zones into possible spotify play devices.

Oh I see they finally released a new spotipy :slight_smile: Gonna see if I can upgrade to that. 2.4.4 (2017), 2.5.0 (2020) and then 2 additional releases in two additional days.

I’ll look at the sonos stuff in more detail and see if I can figure out how it’s supposed to work without having a device…

1 Like