nfarina / homebridge-sonos

Sonos plugin for homebridge: https://github.com/nfarina/homebridge
155 stars 52 forks source link

Stopping the speaker resets the playlist to the first entry #22

Open d34vbd5 opened 8 years ago

d34vbd5 commented 8 years ago

Hi, first: thank you, great plugin! I got one little issue, if i stop a speaker using "turn off 'speakername'" it resets the current Sonos playlist to the first entry. As soon as i use "turn on 'speakername'" it does not continue playing but starts all over again.

Any way to fix this?

thezepter commented 8 years ago

Confirmed... same Issue oder feature here.

edelmaca commented 8 years ago

I happened to run in this problem too. I hope someone can figure this out and make it work like we press the pause button.

BrekiTomasson commented 8 years ago

Yeah, this seems like a pretty dumb bug. Other Sonos APIs use the "pause" command rather than simply stopping all playback. I could be mid-tune and "turn off hallway speaker", and when i "Turn on hallway speaker" it would continue from the same place. Seems like the right way of doing things to me. ;)

Rewrote the following in index.js:

 else {
      this.device.stop(function(err, success) {
          this.log("Stop attempt with success: " + success);

to:

 else {
      this.device.pause(function(err, success) {
          this.log("Stop attempt with success: " + success);

Which fixes matters. Not sure if it breaks something else, though.

BrekiTomasson commented 8 years ago

Ping @edelmaca @thezepter and @d34vbd5 - I have a pull request with a fix here now. Just waiting for the Powers That Be to approve it and implement it in the master build. Until then, you can rewrite the line that has this.device.stop in it to this.device.pause to fix it on your end.

d34vbd5 commented 8 years ago

Thanks!

What's the path to the file where the change has to be done? I can't find my homebridge plugins path...

Am 23.03.2016 um 14:50 schrieb Breki Tomasson notifications@github.com:

Ping @edelmaca @thezepter and @d34vbd5 - I have a pull request with a fix here now. Just waiting for the Powers That Be to approve it and implement it in the master build. Until then, you can rewrite the line that has this.device.stop in it to this.device.pause to fix it on your end.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

thezepter commented 8 years ago

Here are my plugins....

/usr/local/lib/node_modules

edelmaca commented 8 years ago

@BrekiTomasson This single change in that line seems to solve the problem. Perfect. Thank you for that.

d34vbd5 commented 8 years ago

Works like a charm! Thank you

Nousemusic commented 8 years ago

Works for me. Thank you very much.

BrekiTomasson commented 8 years ago

Glad to hear everybody liking the fix! Anyway, solved in #24 if we can get it approved. :)

gizbod commented 8 years ago

I have rewritten the line as suggested above but the problem seems to of not been rectified? what am i doing wrong? I am using a macbook

d34vbd5 commented 8 years ago

I would guess you are doing it wrong. Works fine here

Am 08.04.2016 um 17:40 schrieb gizbod notifications@github.com:

I have rewritten the line as suggested above but the problem seems to of not been rectified? what am i doing wrong?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

gizbod commented 8 years ago

Yea I would guess so. I wonder if I changed the right thing, pretty sure I did though :s

gizbod commented 8 years ago

Even if i delete all the code from the index.js file the plugin still works and I can control the on off of the speakers through siri. so obviously whatever edit i make is having no affect whatsoever. I'm confused with this.

d34vbd5 commented 8 years ago

You do have to restart homebridge

Am 09.04.2016 um 21:06 schrieb gizbod notifications@github.com:

Even if i delete all the code from the index.js file the plugin still works and I can control the on off of the speakers through siri. so obviously whatever edit i make is having no affect whatsoever. I'm confused with this.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

gizbod commented 8 years ago

Yep, I restarted homebridge also.

gizbod commented 8 years ago

thought i would update that i now have this working. I had home bridge set up on my macbook and it wouldn't work but now set up on RPi editing the line has solved the problem.

njsnx commented 8 years ago

Damn, I had this fixed a couple of months ago but never got around to PR'ing it - glad its coming though