Rhasspy and spotify

I’m planning on setting up rhasspy and home assistant again (probably on a pi3) and I would like to find a way to voice control spotify and plex. Searching for music or media may be a bit adventurous, but I’m curious if anyone has managed this or something close.

I happened to stumble on this post and figured I would give my experience with rhasspy and spotify. I see this is a couple months old so I hope you have found your own solution.

But I have tried doing what you trying and it was not easy. I handle intents with a python script. So theory was, I say something like “rhasspy pause spotify” that triggers and intent called “spotifyPause” my python script would then make an API call to spotify and pause whatever is playing. Which didnt sound very complicated.

The issue I ran into was authentication. I believe there were 3 levels of authentication you could perform with spotify, each giving you different ways to interact with spotify and your spotify account. The auth level required to be able to do things like pause and play music required an interactive login every so often. So if you were doing this at a computer a box would pop up for you to enter your spotify username and password. Obviously thats a problem when using a script and a voice only assistant.

So after messing around with it a while I eventually gave up as i could not get around this authentication problem. To be clear, the python API call worked until I had to re-auth, to which I had no way to do that.

In theory plex would work the same way. I have a plex instance and have thought about doing the same API controls with rhasspy but have not set it up yet.

If you plan to have the music come out of the same speaker that rhasspy is using. that will pose a problem as well. Once music is playing out of it, good luck getting the wake word detected. If you have spotify playing out of a different speaker then it would work better. But i messed around with trying to mute the audio on the satellite anytime the wake word was detected, which sort of helped, but it messed with the little tone you hear when rhasspy wakes up where you wont hear that anymore.

I tried then setting up a command to send a pause music call to spotify when the wake word was detected. Which also was promising except for 2 things. First is that if nothing is playing then its a waste of an API call, which isnt too bad and the other being the authentication problem I already mentioned.

So after all that I abandoned it and have not gone back to it since. This was probably around a year ago.

If you find a solution then I would love to hear it. I hope I did not discourage you from trying. I am sure there could have been something i was missing or something I didnt think of that would make it work.

Good Luck!