forslund / spotify-skill

Mycroft Skill to control spotify using the Spotify Connect API
Apache License 2.0
71 stars 38 forks source link

Spotify-skill does not find Sonos device #36

Open dvpfig opened 6 years ago

dvpfig commented 6 years ago

Hi, This is an excellent skill and one of the most useful for a voice assistant.

The spotify and sonos integration works BUT I cannot have Mycroft to control Spotify music to Sonos speaker. When listing spotify devices with voice command such as "list spotify devices", the spotify-skill finds all the local network devices except the Sonos Player3 (also in the local network).

Background: In general, the skill seems to be working good. I have tried successfully to make Mycroft to control my Spotify playing in several applications: on the cellphone (spotify app), raspotify (local on the picroft), the laptop with spotify app, and on the web-player with firefox.

I also have a Sonos Play3 that is the speaker that I use the most with Spotify Premium account. It works fine to use the Sonos application or also any of the Spotify application in cellphone or in laptop to control Spotify music running on the Sonos speaker.

Thanks in advance for the help.

forslund commented 6 years ago

Hi,

I suspect that the Sonos device is in "discovery" mode. Basically it's not logged in to Spotify until you connect to it using your phone or the Spotify player.

I've been looking at this but and gotten as far as finding the device using zeroconf. The tricky part (if it's possible) is to do the handshake and sending over the login info. Librespot has some info in their wiki about this.

dvpfig commented 6 years ago

Thanks for the reply and explanation.

Is there a way to have Sonos in another mode than discovery mode or r spotify?

If not, then I see the only option as a skill specifically for Sonos to control it. With Soco library or similar. Other than using the spotify skill to control sonos.

Controlling Sonos speakers is one of the main skills in other home assistant open source projects. Hopefully coming to Mycroft eventually also :) Is there such skill in the making?

I tried to use openHAB and home-assistant for this effect but those don't have yet controls for media players.

forslund commented 6 years ago

I personally don't own a Sonos so I'm not able to say exactly what's possible there.

Can you provide a link to another project with Sonos support so I can look at how they accomplish this? I'm sure Mycroft will eventually support Sonos. We just need to hook a developer with a device :)

dvpfig commented 6 years ago

Sure, I'm not a programmer, otherwise I would start such project. But I can review and add on top of someone else code.

For Sonos with Python: Use of SoCo library (https://github.com/SoCo/SoCo), a controller for Sonos, seems to be the easiest or most straight forward path. An example is the implementation by home-assistant: https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/media_player/sonos.py

Another way to implement this is how openHAB is doing without SoCo library and seems to be taking XLMparsers: https://github.com/paixaop/openhab2/tree/master/addons/binding/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos

/Daniel

estiens commented 5 years ago

Yes, at this point you'd need to create a sonos mycroft skill (prob the first one I'll work on since SoCo works so well), the spotify devices web api endpoint cannot see sonos devices (or google chromecast devices) etc