rgraciano / echo-sonos

Amazon Echo integration with Sonos
Other
712 stars 234 forks source link

setting a service via voice command to Spotify will set a service name with Capital first. #137

Closed verbem closed 7 years ago

verbem commented 7 years ago

If in advanced mode, if you set the default service via the intent to spotify it will store Spotify in the defaults. A subsequent call to the server endpoint will then contain that Spotify service name, this will lead to errors finding artists etc. If you change the service to lowercase before updating, it works.

petebanham commented 7 years ago

Hi Verbem, I am having the same problem I think as the skill has stopped being about to find tracks etc. Alexa thinks it executes ok but the Lamda logs show that it is erroring and I can see in these logs that the service has a capital S on Spotify. How did you get you service back to lowercase please? Thanks Pete

petebanham commented 7 years ago

OK managed to get rid of the capital by editing directly in the Database but it still isnt working so must be a different issue i am having as well as the Capitalisation.

Logs below which looks like it may not be a skill but a node.js issue on my pi if anyone has any idea please?

START RequestId: 75ee2bbe-0a94-11e7-9c04-d516721eec1b Version: $LATEST 22:04:00 2017-03-16T22:04:00.874Z 75ee2bbe-0a94-1 session applicationId: amzn1.ask.skil 22:04:00 2017-03-16T22:04:00.874Z 75ee2bbe-0 dispatch intent = TrackIntent 22:04:00 2017-03-16T22:04:00.874Z 75ee2bbe-0a94 TrackIntent received for room extension 22:04:00 2017-03-16T22:04:00.874Z 75ee2bbe-0a Advanced Mode = true 22:04:01 2017-03-16T22:04:01.058Z 75ee2bbe-0a94-11e Reading current settings 22:04:01 2017-03-16T22:04:01.159Z 75ee2bbe-0a94-11e room=extension newRoom= service=spotify newService= 22:04:01 2017-03-16T22:04:01.159Z 75ee2bbe-0a94-1 Getting coordinator for room: extension 22:04:01 2017-03-16T22:04:01.159Z 75ee2bbe-0a94-11e7- Calling '/zones' 22:04:01 2017-03-16T22:04:01.414Z 75ee2bbe-0a94-11e7- Call to 'https://xxxxx.hopto.org:5005/zones' suceeded 22:04:01 2017-03-16T22:04:01.414Z 75ee2bbe-0a94-11e Coordinator for extension : Extension 22:04:01 2017-03-16T22:04:01.414Z 75ee2bbe-0a94-11 Calling '/extension/musicsearch/spotify/song/track:bat%20out%20of%20hell' 22:04:02 2017-03-16T22:04:02.268Z 75ee2bbe-0a94- Call to 'https://xxxxx.hopto.org:5005/extension/musicsearch/spotify/song/track:bat%20out%20of%20hell' failed 22:04:02 2017-03-16T22: 75ee2bbe [Error: Failed to retrieve data, status code: 500] 22:04:02 END RequestId: 75e

petebanham commented 7 years ago

Sorry to keep spamming your issue but just to update that this is now working. After changing the music service to be a lower case in the database table, by the time I had posed the error log above it had started working again. So in summary I was having the same issue, as with the capital S it definitely doesn't work (I tested locally on my Node server) Changed to lowercase s, waited 5 mins or so and it is now working again.

verbem commented 7 years ago

I have edited the lambda code. There is a routine that sets the music service. I have added a .to lowercase to the service when it is stored...

Op 16 mrt. 2017 23:01 schreef "petebanham" notifications@github.com<mailto:notifications@github.com>:

Hi Verbem, I ham having the same problem I think as the skill has stopped being about to find tracks etc. Alexa thinks it executes ok but the Lamda logs show that it is erroring and I can see in these logs that the service has a capital S on Spotify. How did you get you service back to lowercase please? Thanks Pete

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rgraciano/echo-sonos/issues/137#issuecomment-287204413, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIktnMTWhawiByh3r3HpBh1EFjPE-lZEks5rmbFBgaJpZM4MTFYy.

petebanham commented 7 years ago

Great thanks

evansgo commented 7 years ago

I'll go and experiment now, but I know little about JS, can you tell me exactly where to add the .to lowercase? Thanks...

verbem commented 7 years ago

I have put the before and after situation in the previous reply

Op 22 mrt. 2017 13:02 schreef evansgo notifications@github.com:

I'll go and experiment now, but I know little about JS, can you tell me exactly where to add the .to lowercase? Thanks...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rgraciano/echo-sonos/issues/137#issuecomment-288378131, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIktnHbhBzdkWsNwToJDtEfwIzcjPjvVks5roQ3RgaJpZM4MTFYy.

evansgo commented 7 years ago

Thanks for the reply but I have read the previous many times and still I cannot understand exactly what to do. I'm sure it's obvious to you but it isn't to me. I have even managed to get it to read SPOTIFY somehow, but never spotify How do you edit database directly? I am editing the code but as I say I am not familiar with JS so it's all a bit of a guess.

verbem commented 7 years ago

OK, trying to spell it out :-)

go into lambda code and advance to line 486, you should see ":s":service in that line, now change that to ":s":service.toLowerCase(), leave everything else on that line untouched! go to line 492, same thing!

hit SAVE or SAVE and TEST

now ALEXA ASK SONOS to change service to spotify and you should be good, for safety set environment variable (below the code) DEFAULT_MUSIC_SERVICE to spotify (or add it if it is not there)

2017-03-23 3:14 GMT+01:00 evansgo notifications@github.com<mailto:notifications@github.com>:

Thanks for the reply but I have read the previous many times and still I cannot understand exactly what to do. I'm sure it's obvious to you but it isn't to me. I have even managed to get it to read SPOTIFY somehow, but never spotify How do you edit database directly? I am editing the code but as I say I am not familiar with JS so it's all a bit of a guess.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rgraciano/echo-sonos/issues/137#issuecomment-288597004, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIktnAnPuHRs0AUlnOWjz2aR2TIXp2nUks5rodVqgaJpZM4MTFYy.

-- Groeten,

Martin Verbeek

evansgo commented 7 years ago

Awsome thank you :) I was very close, but I had the syntax wrong and code being code was not too forgiving...

Thanks again....