node-sonos-http-api icon indicating copy to clipboard operation
node-sonos-http-api copied to clipboard

Playpause not working via NFC

Open n9059007 opened this issue 5 years ago • 3 comments
trafficstars

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

n9059007 avatar Sep 20 '20 22:09 n9059007

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

kentare avatar Sep 21 '20 11:09 kentare

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

hankhank10 avatar Sep 21 '20 12:09 hankhank10

Fixed it now....

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

n9059007 avatar Sep 21 '20 14:09 n9059007