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.84k stars 462 forks source link

Not compatible with Sonos S2 (just tested, see results) #763

Closed roelbroersma closed 4 years ago

roelbroersma commented 4 years ago

I have a large Sonos system containing: mutliple One, Play 5 Gen1, Play 3, Beam, SUB, etc..

I just updated the compatible products to Sonos S2 (which means I did not upgrade the Play 5 Gen1, I migrated that one to a separate Sonos S1 system).

After the update:

http://192.168.5.5:5005/reindex gives {"status":"success"}

http://192.168.5.5:5005/zones gives

[{"uuid":"RINCON_000****","coordinator":{"uuid":"RINCON_000**","state":{"volume":25,"mute":false,"equalizer":{"bass":0,"treble":0,"loudness":true},"currentTrack":{"artist":"","title":"","album":"","albumArtUri":"","duration":0,"uri":"","trackUri":"","type":"track","stationName":""},"nextTrack":{"artist":"","title":"","album":"","albumArtUri":"","duration":0,"uri":""},"trackNo":0,"elapsedTime":0,"elapsedTimeFormatted":"00:00:00","playbackState":"STOPPED","playMode":{"repeat":"none","shuffle":false,"crossfade":false}},"roomName":"Unnamed Room","coordinator":"RINCON_000","groupState":{"volume":25,"mute":false}},"members":[{"uuid":"RINCON_000***","state":{"volume":25,"mute":false,"equalizer":{"bass":0,"treble":0,"loudness":true},"currentTrack":{"artist":"","title":"","album":"","albumArtUri":"","duration":0,"uri":"","trackUri":"","type":"track","stationName":""},"nextTrack":{"artist":"","title":"","album":"","albumArtUri":"","duration":0,"uri":""},"trackNo":0,"elapsedTime":0,"elapsedTimeFormatted":"00:00:00","playbackState":"STOPPED","playMode":{"repeat":"none","shuffle":false,"crossfade":false}},"roomName":"Unnamed Room","coordinator":"RINCON_000****","groupState":{"volume":25,"mute":false}}]}]

(I masked private information using **** )

Which means: I think I see a zone, maybe my 1x Play5 Gen1 ?
The other 20x speakers I can not see... I did not found any specifig information for the new S2 API, besided the: https://developer.sonos.com -> Reference. Which was updated in April 2020, that gives me the idea that only Cloud connection is possible... ?

hankhank10 commented 4 years ago

It's definitely compatible with S2. I have also updated to S2 (and have been using the beta for a few months) and the API has and continues to work fine for me. All six of my zones on S2 are visible and work.

I think you probably need to create a settings.json and include a "household" option to specify that the API should talk to your S2 system rather than your S1. There are instructions in the readme.md

roelbroersma commented 4 years ago

Thanks! I am trying it now. Did you fill in the full

"household":"Sonos_xxxxxxxxxxxxxxxxxxxxxxxxxx",

or only:

"household":"Hwq03L0Xx3Sn5fcPE91ZKq2mxN.AGejB3sBSr_G1byFUvJR",

?

hankhank10 commented 4 years ago

I didn't need to add the household option to mine as mine defaulted to the S2 (probably because I set up my S2 first and only my S1 later). The docs seem to suggest that it should be in the format "Sonos_xxxx"

One point to note: it does need to be a new file called "settings.json" you create to put this in. Don't get confused with the existing "settings.js".

sw764206 commented 4 years ago

I can confirm that it does work with S2 too. Tried this morning. Quick question, is there a way now to play things on Sono's new "saved groups?" instead of using the http server join & leave commands to manually ungroup and group?

martin-g-it commented 4 years ago

Got another confirmation that S2 works with the API..

martin-g-it commented 4 years ago

I can confirm that it does work with S2 too. Tried this morning. Quick question, is there a way now to play things on Sono's new "saved groups?" instead of using the http server join & leave commands to manually ungroup and group?

Playing around with this feature it seems like you select rooms upon choosing the Saved groups.. logically it doesn’t seem straightforward to have this feature included in the API as this API controls a specific room (and with that other rooms the controller room is grouped with).

roelbroersma commented 4 years ago

I can confirm it works with S2.

First it would want to discover... So I changed my settings.json with the "household": "" without any luck... later I removed it and suddenly it worked.. :(

kaarthikalagappan commented 4 years ago

Worked for me too :) I didn't change any settings after the update to see if it worked as it is, and it did 👍

ayn commented 4 years ago

Works for me as well.

jishi commented 4 years ago

Thank you everyone that has reported about S2. I'm kind of surprised that they didn't take the opportunity to move on from the UPnP protocol, makes me also wonder why the fuck they couldn't keep compatibility with older devices then... if they both use the same control mechanism.

skokarl commented 4 years ago

Thank you everyone that has reported about S2. I'm kind of surprised that they didn't take the opportunity to move on from the UPnP protocol, makes me also wonder why the fuck they couldn't keep compatibility with older devices then... if they both use the same control mechanism.

Hallo, I have read there is not enough system power or memory in the older devices.

LJSven commented 4 years ago

Does it mean, that i can do the update? On my Sonos ONE, the speak data point is not working right now.

skokarl commented 4 years ago

Does it mean, that i can do the update? On my Sonos ONE, the speak data point is not working right now.

mit dem Datenpunkt im Adapter hat die Sonos API nix zu tun.

LJSven commented 4 years ago

Das weiß ich - die Frage war eigentlich ob ein Update "bedenkenlos" möglich ist.

skokarl commented 4 years ago

it works !

KateiRen commented 4 years ago

Looking forward to see more positive confirmations over time. I could live without the offical app, but would not risk breaking this amazing API which I use multiple times a day (dash buttons, automation, dashboard).

roelbroersma commented 4 years ago

Looking forward to see more positive confirmations over time. I could live without the offical app, but would not risk breaking this amazing API which I use multiple times a day (dash buttons, automation, dashboard).

I can confirm everything works. I tested Spotify, Text-To-Speech, presets,.. all working.

vkoi81 commented 4 years ago

For the folks that are still working, by any chance have you rebooted your rPi or router since the Sonos update? My setup broke after I temporarily lost power and curious if after the update everything continues to work until a reboot.

Sorry in advance if this is not the right place to post this.

I tried adding the household option into settings.json but it didnt help. Logs seem to show the program is terminating unexpectedly.

0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ] 2 info using npm@6.14.5 3 info using node@v10.21.0 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle sonos-http-api@1.6.9~prestart: sonos-http-api@1.6.9 6 info lifecycle sonos-http-api@1.6.9~start: sonos-http-api@1.6.9 7 verbose lifecycle sonos-http-api@1.6.9~start: unsafe-perm in lifecycle true 8 verbose lifecycle sonos-http-api@1.6.9~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/node-sonos-http-api/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games 9 verbose lifecycle sonos-http-api@1.6.9~start: CWD: /home/pi/node-sonos-http-api 10 silly lifecycle sonos-http-api@1.6.9~start: Args: [ '-c', 'node server.js' ] 11 silly lifecycle sonos-http-api@1.6.9~start: Returned: code: 1 signal: null 12 info lifecycle sonos-http-api@1.6.9~start: Failed to exec start script 13 verbose stack Error: sonos-http-api@1.6.9 start: node server.js 13 verbose stack Exit status 1 13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:198:13) 13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:198:13) 13 verbose stack at maybeClose (internal/child_process.js:982:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) 14 verbose pkgid sonos-http-api@1.6.9 15 verbose cwd /home/pi/node-sonos-http-api 16 verbose Linux 4.19.118-v7l+ 17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start" 18 verbose node v10.21.0 19 verbose npm v6.14.5 20 error code ELIFECYCLE 21 error errno 1 22 error sonos-http-api@1.6.9 start: node server.js 22 error Exit status 1 23 error Failed at the sonos-http-api@1.6.9 start script.

kaarthikalagappan commented 4 years ago

@vkoi81 mine also broke after rebooting rPi (it wasn't able to discover the system) but was able to fix it after restarting just the npm server (restarting just this service)

vkoi81 commented 4 years ago

@vkoi81 mine also broke after rebooting rPi (it wasn't able to discover the system) but was able to fix it after restarting just the npm server (restarting just this service)

Thanks. I’ll give that a shot. You simply did an npm stop followed by npm start?

ayn commented 4 years ago

Haven't tried, I did lose power for a second this afternoon but luckily my Pi's are connected to a UPS.

kaarthikalagappan commented 4 years ago

@vkoi81 mine also broke after rebooting rPi (it wasn't able to discover the system) but was able to fix it after restarting just the npm server (restarting just this service)

Thanks. I’ll give that a shot. You simply did an npm stop followed by npm start?

Sorry about the delay. Yes! I'm using pm2 (and Ngnix) to run it in the background so I just restarted that