rgraciano / echo-sonos

Amazon Echo integration with Sonos
Other
713 stars 235 forks source link

Adds support for Open Sonos command #176

Closed jplourde5 closed 7 years ago

jplourde5 commented 7 years ago

Saying "Alexa, open Sonos" or "Alexa, start Sonos", etc. invokes Sonos. The current room and service are indicated followed by a "What would you like to do next?". You can continue to perform multiple commands without having to repeat "Alexa, ask Sonos...". You can conclude at any point by answering "I'm finished", "Finished", "Done", etc.

jplourde5 commented 7 years ago

Spotify changed their search API and it now requires authentication.

So where are you stuck? Are you trying to get the proxy to work?

loftgren commented 7 years ago

I thought maybe I would start from scratch as far as my node-sones-http-api-master running on my server, and I was hoping that you would walk me through it? Im actually not sure what I'm supposed to download anymore.... your version, or the other, or what? any chance you could walk me through it?

jplourde5 commented 7 years ago

Follow the readme on this site, line by line, as well as the node-sones-http-api. Do not bother with the sqs-proxy. You can come back to the proxy if you get the rest working.

loftgren commented 7 years ago

ok thanks... do you mean this READ ME? https://github.com/jishi/node-sonos-http-api

loftgren commented 7 years ago

or this one: https://github.com/rgraciano/echo-sonos/blob/master/README.md

or both?

jplourde5 commented 7 years ago

Start with echo-sonos which should be your main guide, and drill down to node-sones-http-api for the Spotify and Pandora setup

loftgren commented 7 years ago

so I have installed node-sonos-http-api without error... next is the presets folder. This has never made sense to me. When I had things working I never messed with it. Is it ok to just leave it alone?

jplourde5 commented 7 years ago

Yes, I don't use presets either. Make sure at this point that you get the Spotify and Pandora settings in place and tested successfully by invoking the urls as described in the readme.

loftgren commented 7 years ago

do you have any clarity on copying options.example.js to options.js? Seems very confusing

jplourde5 commented 7 years ago

Just fill in these three values and ignore the rest.

appid: "Your app ID from the Lamda console", host: "your public IP address on your firewall for getting to node-sones-http-api", port: "The port that you are using for node-sonos-http-api. Default is 5005 I believe",

loftgren commented 7 years ago

i thought advanced mode took care of that? do i need to actually enter that information in the options file?

loftgren commented 7 years ago

i just keep getting the Invalid music service message in my terminal window. I can get my zones, I can play/pause... I can enter http://myserverip:5005/kitchen/playlist/alarm and it works, but nothing involving Spotify or Pandora.

loftgren commented 7 years ago

this is my setting.json file: { "pandora": { "username": "acct email", "password": "acct pw" }, "spotify": { "clientId": "clientid", "clientSecret": "secret" } }

jplourde5 commented 7 years ago

What url are you using to play a Spotify song?

jplourde5 commented 7 years ago

And you did fill in actual values in the settings.json file, correct?

loftgren commented 7 years ago

even though I have enabled advanced mode and have entered that info there?

loftgren commented 7 years ago

sorry... yes, I did that. it is located in the same directory as the node-sones-http-api-master

loftgren commented 7 years ago

screen shot 2017-06-27 at 4 00 04 pm

loftgren commented 7 years ago

does that look right?

loftgren commented 7 years ago

when i paste this:

myserverip:5005/kitchen/musicsearch/pandora/station/jazz%20anova

i get this in cloud watch:

screen shot 2017-06-27 at 4 05 21 pm

jplourde5 commented 7 years ago

Let's get one thing working before we move on to the next. At this point we want to get node-sonos-http-api working locally inside your firewall using your browser to invoke the urls. On the server that you installed node-sonos-http-api on, invoke http://localhost:5005/kitchen/pandora/play/{station name} where {station name} is one of your valid, existing station names. BTW, your url above is not correct. There is no pandora service for music search. Pay very close to the example URLs in the readme.

loftgren commented 7 years ago

{"status":"error","error":"An unexpected error occurred [1002]","stack":"Error: An unexpected error occurred [1002]\n at Request._callback (/Users/christophermurray/Downloads/node-sonos-http-api-master/node_modules/anesidora/anesidora.js:39:33)\n at Request.self.callback (/Users/christophermurray/Downloads/node-sonos-http-api-master/node_modules/request/request.js:188:22)\n at emitTwo (events.js:106:13)\n at Request.emit (events.js:191:7)\n at Request. (/Users/christophermurray/Downloads/node-sonos-http-api-master/node_modules/request/request.js:1171:10)\n at emitOne (events.js:96:13)\n at Request.emit (events.js:188:7)\n at IncomingMessage. (/Users/christophermurray/Downloads/node-sonos-http-api-master/node_modules/request/request.js:1091:12)\n at IncomingMessage.g (events.js:291:16)\n at emitNone (events.js:91:20)\n at IncomingMessage.emit (events.js:185:7)\n at endReadableNT (_stream_readable.js:974:12)\n at _combinedTickCallback (internal/process/next_tick.js:74:11)\n at process._tickDomainCallback (internal/process/next_tick.js:122:9)"}

loftgren commented 7 years ago

This is what I posted: http://localhost:5005/kitchen/pandora/play/{Adele Radio}

loftgren commented 7 years ago

Also tried it with "Radio" and without {}

loftgren commented 7 years ago

This in terminal window: 2017-06-27T20:37:54.944Z ERROR Error: An unexpected error occurred [1002] at Request._callback (/Users/christophermurray/Downloads/node-sonos-http-api-master/node_modules/anesidora/anesidora.js:39:33) at Request.self.callback (/Users/christophermurray/Downloads/node-sonos-http-api-master/node_modules/request/request.js:188:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request. (/Users/christophermurray/Downloads/node-sonos-http-api-master/node_modules/request/request.js:1171:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at IncomingMessage. (/Users/christophermurray/Downloads/node-sonos-http-api-master/node_modules/request/request.js:1091:12) at IncomingMessage.g (events.js:291:16) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickDomainCallback (internal/process/next_tick.js:122:9)

jplourde5 commented 7 years ago

There should be no {} in the actual url. Pull up Pandora in your Sonos controller app and use one of the stations that you see there, spelled exactly like you see it in Sonos.

loftgren commented 7 years ago

Straight from Pandora within Sonos app:

74.75.123.155:5005/kitchen/pandora/play/Amy Winehouse Radio

returned same as above.

Tried it with and without spaces

jplourde5 commented 7 years ago

Let's switch to Spotify. Try

74.75.123.155:5005/kitchen/musicsearch/spotify/song/artist:boston

loftgren commented 7 years ago

That worked!!!

jplourde5 commented 7 years ago

Getting somewhere! Try

74.75.123.155:5005/kitchen/musicsearch/spotify/song/more than a feeling

and other songs and artists

loftgren commented 7 years ago

I tried adele twice... the first time it played a Paul McCartney song, but the second time it played Adele.

loftgren commented 7 years ago

but the more than a feeling did not work....

loftgren commented 7 years ago

it actually pulled up a Google search...

loftgren commented 7 years ago

I just went back and tried the first Boston link and it did not work....

loftgren commented 7 years ago

it actually played a song called Boston Manner by Be Nothing

loftgren commented 7 years ago

Trying it again it is just coming up with random songs... now another Paul McCarthey and Wings...

loftgren commented 7 years ago

Now it did come up with Boston Rock and Roll Band

loftgren commented 7 years ago

This worked:

http://74.75.123.155:5005/kitchen/musicsearch/spotify/song/artist:Bruno%20Mars

loftgren commented 7 years ago

but not able to get individual songs....

loftgren commented 7 years ago

Still can't do anything with Alexa without getting "Invalid Music Service" though... but making progress! But she will still play and pause etc...

Vurnen commented 7 years ago

Hi all. First thanks for all your hard work here. Much appreciated. Im a total noob here, but managed to get mij Echo dot communicating with my Sonos 1 with rgraciano's instructions and files. Till now I can only do the basics, like start en resume playing a radiostation I mostly have on Sonos. Im ready to make the step to Spotify but I cant manage to figure out what exactly im supposed to edit or add. I have my spotify client ID and API key. Should I just zip all the jplourde5 files in lib, upload in lambda funtion and edit spotify ID and Key in the code once in Lambda?

jplourde5 commented 7 years ago

Try 74.75.123.155:5005/kitchen/musicsearch/spotify/song/track:more than a feeling

jplourde5 commented 7 years ago

Vurnen, You should use the normal distributions, not any of my forks. The instructions for getting Spotify to work can be found in the node-sonos-http-api readme in the settings.json file section.

loftgren commented 7 years ago

screen shot 2017-06-28 at 2 06 21 pm

loftgren commented 7 years ago

When I added %20 between words it worked! http://74.75.123.155:5005/kitchen/musicsearch/spotify/song/track:more%20than%20A%20FEeling

loftgren commented 7 years ago

But Pandora still a no go...

loftgren commented 7 years ago

Ok! I got Pandora working! I had a misspelling in the setting.json credentials.... Ugghhh! So now I can call to both Spotify and Pandora, but not through Alexa.

loftgren commented 7 years ago

I feel like we are soooo close....

loftgren commented 7 years ago

So the problem is clearly with Lambda Configuration I think. I can test a request in the Alexa skills test area and all looks good.

jplourde5 commented 7 years ago

Catching up. Great progress. So you are able to play music using the Alexa Test function?