rgraciano / echo-sonos

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

Favorites and Presets load but do not play #17

Closed rwupson closed 8 years ago

rwupson commented 8 years ago

I have this awesome setup working for most things, however when I tell Sonos "Alexa, tell Sonos to play favorite "MY Favorite" in the Living Room" it loads up the favorite in the Sonos app but does not start playing. Same thing happens with presets. Please help!

BarriePike commented 8 years ago

I have noticed that playlists that have a single word e.g. 'Genesis' have no issue playing. However, two word descriptors such as 'Boy's Favorites' with a space between the words do not. Changing the descriptor to 'Boysfaves' fixed the issue for me. This is just my own experience. I am sure it wasn't meant to work like this and my British accent has sometimes caused other issues with Alexa!.

rwupson commented 8 years ago

Single word presets/playlists do not work for me either. Really does a good job changing to the station but just queues it, still have to press play in the songs app.

rgraciano commented 8 years ago

I'll take a look this week when I have a few kid-free minutes at home. I'm guessing this will be as simple as sending a /play command after favorite and playlist requests

BarriePike commented 8 years ago

Thanks. Also, a huge thank you for putting this skill together.

Sent from my mobile device.

On Feb 6, 2016, at 6:55 PM, Ryan Graciano notifications@github.com wrote:

I'll take a look this week when I have a few kid-free minutes at home. I'm guessing this will be as simple as sending a /play command after favorite and playlist requests

— Reply to this email directly or view it on GitHub.

swerb73 commented 8 years ago

Jumping into the thread, same issue here, seems I have to actually hit Play in the sonos app when changing favorites. Doesn't matter if it is one word or multiple word favorites. Thanks for any help!

rwupson commented 8 years ago

Has anyone been able to resolve this issue? Much appreciation for everyones help!

rgraciano commented 8 years ago

@rwupson - I put together a small fix for this issue, but I'm out skiing this week so I can't actually test it :) If you want to be a bleeding edge adopter, then here are the instructions to test it yourself:

Add this function at the bottom of index.js:

/** Handles playlists and favorites */
function playlistHandler(roomValue, presetValue, skillName, response) {
    var room = encodeURIComponent(roomValue);
    var playlist = encodeURIComponent(presetValue);

    options.path = '/' + room + '/' + skillName + '/' + playlist;
    httpreq(options, function() {});

    options.path = '/' + room + '/play';
    httpreq(options, function() {
        response.tell("Queued and started " + playlist);
    });
}

Delete the functions for PlaylistIntent and FavoriteIntent elsewhere in index.js. Replace them with:

PlaylistIntent: function (intent, session, response) {  
    console.log("PlaylistIntent received");
    playlistHandler(intent.slots.Room.value, intent.slots.Preset.value, 'playlist', response);
},

FavoriteIntent: function (intent, session, response) {
    console.log("FavoriteIntent received");
    playlistHandler(intent.slots.Room.value, intent.slots.Preset.value, 'favorite', response);
},

And that's it - zip up the stuff in lambda's src/ folder including your new index.js, upload to Lambda, and see if it works.

cricenog commented 8 years ago

No luck here...the echo did say "Queued and started PLAYLIST" but then nothing unfortunately!! I have 3 devices, trying this one on the Master Bedroom, anyone else have any luck? Thanks!!

rgraciano commented 8 years ago

I pushed a fix today and verified it's working on my local setup. The quick patch I'd hacked out here wasn't using actOnCoordinator, but the new version does and seems to be reliable.

Note that I saw some weird behavior with actOnCoordinator before I upgraded node-sonos-http-api to the latest version, so if you have any trouble, give that a try first.

rgraciano commented 8 years ago

Note: to upgrade, upload index.js to Lambda. The new index.js also merges a pull request from someone who added room functionality to pause/resume, so you should update utterances and intents in the Alexa Skills Kit while you're at it, if you want those features to continue working.

BarriePike commented 8 years ago

Thanks very much Ryan. Great product.

From: Ryan Graciano [mailto:notifications@github.com] Sent: Sunday, February 14, 2016 11:35 AM To: rgraciano/echo-sonos echo-sonos@noreply.github.com Cc: BarriePike barriepike@hotmail.com Subject: Re: [echo-sonos] Favorites and Presets load but do not play (#17)

I pushed a fix today and verified it's working on my local setup. The quick patch I'd hacked out here wasn't using actOnCoordinator, but the new version does and seems to be reliable.

Note that I saw some weird behavior with actOnCoordinator before I upgraded node-sonos-http-api to the latest version, so if you have any trouble, give that a try first.

— Reply to this email directly or view it on GitHub https://github.com/rgraciano/echo-sonos/issues/17#issuecomment-183933929 .

rwupson commented 8 years ago

Awesome - I am going to try it now - Thanks very much - agreed, great product!