Testing and Feedback - Sonos Spotify Mycroft skill

This skill allows to use voice commands to play (specifically) Spotify music on a Sonos speaker

How to install Spotify Sonos Bot

  • Check the readme in the github repo
  • Warning: the setup is on the rough side because it requires also installing another open source project. But I will gladly help personally, just hit me here, on gitter, or on the mycroft chat server https://chat.mycroft.ai/community/channels/skills

I will definitely try this, the only downside is to have Node.js running.

Good job @sinopsychoviet

Great, let me know how it goes! I use it everyday and it works like a charm, but it is obviously tailored to my needs :slight_smile: . Having sonos & spotify was a deal breaker for me when deciding whether or not adopting Mycroft.

After the skill has been installed, Mycroft doesn’t start anymore.
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/mycroft_skill/mycroft_skill.py", line 1296, in default_shutdown
    self.stop()
  File "/opt/mycroft/skills/spotify-sonos-bot-skill.lnguyenh/__init__.py", line 62, in stop
    stop(self.speaker)
  File "/opt/mycroft/skills/spotify-sonos-bot-skill.lnguyenh/sonos_api.py", line 25, in stop
    return get(API_URL + speaker + '/' + 'pauseall')
TypeError: can only concatenate str (not "NoneType") to str
 18:27:50.190 | ERROR    | 11904 | mycroft.skills.skill_loader:_create_skill_instance:313 | Skill initialization failed with Type~~~~
Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/skill_loader.py", line 307, in _create_skill_instance
    self.instance.initialize()
  File "/opt/mycroft/skills/spotify-sonos-bot-skill.lnguyenh/__init__.py", line 23, in initialize
    self.on_settings_changed()
  File "/opt/mycroft/skills/spotify-sonos-bot-skill.lnguyenh/__init__.py", line 37, in on_settings_changed
    set_volume(self.speaker, volume)
  File "/opt/mycroft/skills/spotify-sonos-bot-skill.lnguyenh/sonos_api.py", line 40, in set_volume
    return get(API_URL + speaker + '/' + 'volume/' + str(wanted_volume))
TypeError: can only concatenate str (not "NoneType") to str
 18:27:50.195 | ERROR    | 11904 | mycroft.skills.skill_loader:_communicate_load_status:351 | Skill spotify-sonos-bot-skill.lnguy~~~~

This is due to this commit: https://github.com/lnguyenh/spotify-sonos-bot-skill/commit/444a1a1e03bb0c8ae69e42753e528c7cf0e0cff9

I just removed the 20 from and now the service starts and the skill is available from the web interface and now I’m able to play Spotify on my speaker.

One tricky point to understand was why I was not able to play playlists… The answer is that my Spotify credentials was required by node-sonos-http-api application.

Any plan to add the multi-speaker support?

Thanks :+1:

Good feedback! I will update the Readme with a bit more info about the node-sonos-http-api setup, and get rid of the superstitious commit :). Now that there is more than one user, I might get motivated to add multi room. Great to hear that you can play Spotify. Let me know if you feel you miss some voice commands.

Just wondering, how is the wake-word recognition working for you? That was arguably the second deal breaker for Mycroft adoption, and at the start it didnt work well for my wife and kids. But there is a beta “hey mycroft” wake-word model that you may be interested in if you experience some wake-word issues.

@sinopsychoviet you are very welcome!

I got some questions:

  • Why not try to implement the Sonos integration to the existing Spotify module?
  • As Alexa and Google, why not to just have the Sonos skill available which could open the range of integration with Mycroft and Sonos?
  • Having the Node.js to interact with Sonos deployed automatically with the skill could be a great addition.

I know that all of theses questions have pros and cons, I just would like to hear your feedback from it. :slight_smile:

About my wake word, I had few issues mostly because of a very bad microphone[1]… Then I switched to a better microphone[2] which solved so many issues!

Then I changed the wake word and used mine (mirror mirror) by using the Precise engine[3], I reduced a little bit the threshold and now it works 95% of the time (still think the microphone is not perfect).

[1] https://www.amazon.ca/Tanbin-Computer-Microphone-Smallest-Recording/dp/B06XVMP7FF/ref=sr_1_5?dchild=1&keywords=Mini+USB+Microphone+for+Computer&qid=1606576409&s=electronics&sr=1-5
[2] https://www.amazon.ca/gp/product/B0823N6XL5/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1
[3] https://mycroft-ai.gitbook.io/docs/using-mycroft-ai/customizations/wake-word

When I started to play with Mycroft, I was more thinking about using a Sonos skill and found this one: Sonos controller skill - testing and feedback , which I tried but it did not support Spotify. So I created my own skill, for a number of reasons like: 1) it was fun to try, 2) I could add the commands that felt most natural to me.

I did discard using the existing Spotify skills, but maybe for wrong reasons, I realize now. 1) I thought the skill was limited to playing Spotify on the actual Mycroft device. 2) I thought that there was an issue with credentials that made the skill not “working” anymore. I believe there is still this issue, but that you can work around it by using your own credentials, like I do myself. I got a bit “scared” by the warnings in the readme of the skill and some forum/chat discussions.

So no real good reasons for your 2 first questions @goldyfruit :), except that I knew what I wanted to achieve (the exact commands I need when cooking dinner :slight_smile: ) and just pushed forward until I had the device I wanted, having fun in the process building a skill from scratch and discovering how the Mycroft, Spotify and Sonos ecosystems work.
You made me re-read about the existing Spotify skill, and adding support for Sonos there may be a good/better way forward for Mycroft in general, especially if we manage to solve the dev credentials issue which is not “general public” friendly.
Having a a general dedicated Sonos app would also be a great thing to have, I agree.

1 Like