jishi / node-sonos-http-api

An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.85k stars 460 forks source link

Playpause not working via NFC #776

Open n9059007 opened 4 years ago

n9059007 commented 4 years ago

I'm using NFC cards to play Spotify on my Sonos. I have a number of playlists, albums, etc set up. I recently made a "Playpause" NFC card so that I can play/pause music without having to go into the app. For some reason, the code when sent via NFC just stops the current playlist and clears the queue, rather than pausing it as it should. I've tested the code in a browser on the network and it works correctly then... it just doesn't work when sent via NFC for some reason. Any suggestions!?

Thanks

kentare commented 4 years ago

How do you handle the calls to node-sonos-http-api?

Maybe you have defaulted to always clear queue on each call? I use a flag to know if I should clear the queue or not.

Roughly like this

list = {
    rfidkey1: {  url: xxxx, clearQueue: true  },
    rfidkey2: { url: http://localhost:5005/living%20room/playpause, clearQueue: false }
}

command = list[rfidkey]
if(command.clearQueue) {
      // Clear queue
}
// Do url call
hankhank10 commented 4 years ago

I don't know if this will solve your issue, but you might find this project which uses NFC tags and this api (and does work with playpause) useful:

https://github.com/hankhank10/vinylemulator

n9059007 commented 4 years ago

Fixed it now....

For some reason spotify:playpause does not work However, command:playpause does!