This is my first attempt of making a skill and I have also basically no experience with python or github at all.
Sonos Music Controller Skill:
A Mycroft Skill to control your Sonos speakers. It supports basic commands (such as “play” “pause” “skip” …) but also playing music via different services such as Apple Music and Spotify.
My skill doesn’t require any user authentication, looks for music through the music service APIs (iTunes Search API and Spotify API), and then takes the found ID and converts it to an URI the Sonos players can understand. I took those URIs from jishis Node Sonos package (GitHub - jishi/node-sonos-http-api: An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.) and even opened an issue discussing this way of controlling music services via the python SoCo package (Able to play music from Apple Music · Issue #812 · SoCo/SoCo · GitHub)
Currently the skill won’t work with Spotify for about the first minute of every hour. That’s because of the authentication token with the Spotify API, that I’m using to get the Spotify IDs.
Recently I stumbled overt this skill: GitHub - smartgic/mycroft-sonos-controller-skill: Control Sonos speakers with music services support such as Spotify, that aims to provide the same functionality. I started my skill development last November, so I thought such a skill hadn’t been tried before and I didn’t look on github or on this forum since then. Maybe we could merge those skills together somehow because two skills for the same purpose seem unneccessary.
mycroft-msm install https://github.com/QW3RTZUI0P/sonos-music-controller-skill
Just install this skill via mycroft-msm and choose your preferred service. Until now Apple Music is fully supported and with Spotify you can play songs (at least it works on my end, I didn’t test it on other Sonos systems). Just be sure that the placement value in your device settings on home.mycroft.ai is exactly the name of your Sonos speaker.
- skip / next track
- previous track
- play let it be by the beatles
- play the album parachute by coldplay
- play music by coldplay
Any feedback would be greatly appreciated. Privately I’m using Apple Music and now I started my 30-day free trial for Spotify to develop this skill so I don’t have tons of time to develop this without paying ;).
Any error logs or something similar you get when you try to use this skill would also be a great help.
Feedback can be provided via GitHub issues or this forum.
I’m working on a documentation on how my skill functions in the skill repo, but I don’t want to write much until I’m quite sure that the way the skill handles music now is the way to go.
If you have any problems or questions please don’t hesitate to contact me.