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

Sonos S2 API

Open dgmltn opened this issue 5 years ago • 20 comments

I just upgraded to S2 API and haven't found anything here that doesn't work. Play/pause/status reporting etc all seem to still work fine.

dgmltn avatar Jun 10 '20 16:06 dgmltn

Thanks for the info and verification. Some other users reported the same, see here: https://github.com/jishi/node-sonos-http-api/issues/763

marco79cgn avatar Jun 11 '20 22:06 marco79cgn

I too have issues after upgrade to S2. Try to add "household":"Sonos_{longId}" as described in #763 but no change. Can't find my system :(

Any ideas??

mcpetermohr avatar Jun 15 '20 19:06 mcpetermohr

Oh btw, running the latest version on a Pi... worked until I accidentally "upgraded" to S2 over the weekend so firewalls etc should be just fine

mcpetermohr avatar Jun 15 '20 19:06 mcpetermohr

To be clear, I do NOT have any issues.

I wonder what's the difference between our setups. I have these devices: Playbar Play:3 Several Play:1's

I do not have any of the newer devices. Perhaps that's the difference.

dgmltn avatar Jun 15 '20 22:06 dgmltn

I have one or more of these: ONE Play:1 Play:5 Gen2 Playbar

mcpetermohr avatar Jun 16 '20 06:06 mcpetermohr

@mcpetermohr The household should only be required if you have a split system (S1 and S2).

How is your pi connected to the network? There must be something else going on. You should check the health of the pi, disk space, etc.

jishi avatar Jun 16 '20 11:06 jishi

Cable. I use it for OpenHab also and everything else seems to work just fine... If I add household I keep getting:

No system has yet been discovered. Please see https://github.com/jishi/node-sonos-http-api/issues/77 if it doesn't resolve itself in a few seconds.

and if I don't have "household" in settings.json it won't even start $attr error

mcpetermohr avatar Jun 16 '20 11:06 mcpetermohr

All my devices are upgraded to S2

mcpetermohr avatar Jun 16 '20 11:06 mcpetermohr

And everything worked until I upgraded to S2

mcpetermohr avatar Jun 16 '20 11:06 mcpetermohr

@mcpetermohr You need to be a bit more specific, and don't post multiple comments. You notify everyone in this thread for every message you post.

Is it connected directly to your router? At the back of one of your players? Are you running WiFi mode on Sonos, or Boost mode (having at least one sonos-device wired)?

Just because everything worked up until the upgrade doesn't necessarily mean that the upgrade is the cause. It could just have woken up a latent error with the upgrade.

That you get an $attr error sounds more like the discovery process actually fails to parse the output from the player, so it would be helpful if you could provide the full error log when that happens.

jishi avatar Jun 16 '20 12:06 jishi

Sorry!

My Sonos devices are a mix of wifi and cabled configs. The Pi is cabled. All are connected to the same unmanaged switch. I'd to happy to provide any logs, but I don't know which to include. I can also provide dumps from <IP>:14000/status/zp - anything to get this rolling again :)

Just let me know what you need!

Peter

mcpetermohr avatar Jun 16 '20 12:06 mcpetermohr

I bit the bullet and updated my Sonos app to S2 as well. My system had the old bridge which I removed from the setup per Sonos' instructions. I.e. my Sonos speakers is now using WiFi (no Boost or Bridge). Everything was still working fine up until yesterday when I lost power and router and Raspberry Pi rebooted. Now I see that the Sonos API is running as I can get to the webpage but unable to invoke any commands. Just references me to Issue #77.

For the folks that updated and everything is still working, did you happen to reboot any equipment to see if it still works? I will also be happy to provide any logs.

vkoi81 avatar Jun 17 '20 01:06 vkoi81

I think that everybody already tried this, but just to be sure ^^ I had to reboot my Router/Pi after the update to S2. After that everything worked as before.

jnbht avatar Jun 17 '20 09:06 jnbht

Yes, did reboot :)

I made some progress here... I was running an old version of nodejs... After the update (and removal of "household") I can now see my Sonos system again...

I do get errors like this all the time, but I don't know if I also did that before.... Never checked:

2020-06-17T10:23:46.295Z ERROR TypeError: Cannot read property 'length' of undefined at XmlEntities.exports.XmlEntities.XmlEntities.decode (/home/pi/sonos/node_modules/sonos-discovery/node_modules/html-entities/lib/xml-entities.js:48:15) at NotificationListener.notificationHandler (/home/pi/sonos/node_modules/sonos-discovery/lib/models/Player.js:262:42) at NotificationListener.emit (events.js:327:22) at NotificationListener.EventEmitter.emit (domain.js:485:12) at /home/pi/sonos/node_modules/sonos-discovery/lib/NotificationListener.js:125:17 at processTicksAndRejections (internal/process/task_queues.js:97:5) 2020-06-17T10:23:46.554Z ERROR TypeError: Cannot read property 'length' of undefined at XmlEntities.exports.XmlEntities.XmlEntities.decode (/home/pi/sonos/node_modules/sonos-discovery/node_modules/html-entities/lib/xml-entities.js:48:15) at NotificationListener.notificationHandler (/home/pi/sonos/node_modules/sonos-discovery/lib/models/Player.js:262:42) at NotificationListener.emit (events.js:327:22) at NotificationListener.EventEmitter.emit (domain.js:485:12) at /home/pi/sonos/node_modules/sonos-discovery/lib/NotificationListener.js:125:17 at processTicksAndRejections (internal/process/task_queues.js:97:5) 2020-06-17T10:23:47.205Z ERROR TypeError: Cannot read property 'length' of undefined at XmlEntities.exports.XmlEntities.XmlEntities.decode (/home/pi/sonos/node_modules/sonos-discovery/node_modules/html-entities/lib/xml-entities.js:48:15) at NotificationListener.notificationHandler (/home/pi/sonos/node_modules/sonos-discovery/lib/models/Player.js:262:42) at NotificationListener.emit (events.js:327:22) at NotificationListener.EventEmitter.emit (domain.js:485:12) at /home/pi/sonos/node_modules/sonos-discovery/lib/NotificationListener.js:125:17 at processTicksAndRejections (internal/process/task_queues.js:97:5) 2020-06-17T10:23:47.473Z WARN Failed when trying to set playmode REPEAT_ALL, could be playing radiostation or line-in, no worries. Error at Object.invoke (/home/pi/sonos/node_modules/sonos-discovery/lib/helpers/soap.js:95:10) at /home/pi/sonos/node_modules/sonos-discovery/lib/models/Player.js:650:19 at processTicksAndRejections (internal/process/task_queues.js:97:5) 2020-06-17T10:23:47.489Z WARN setPlayMode failed Error at Object.invoke (/home/pi/sonos/node_modules/sonos-discovery/lib/helpers/soap.js:95:10) at /home/pi/sonos/node_modules/sonos-discovery/lib/models/Player.js:662:19 at processTicksAndRejections (internal/process/task_queues.js:97:5)

-- Upgrade info: https://medium.com/@bipul.k.kuri/upgrade-node-js-npm-in-raspbian-on-raspberry-pi-f1bcdaa23db5 https://thisdavej.com/upgrading-to-more-recent-versions-of-node-js-on-the-raspberry-pi/

mcpetermohr avatar Jun 17 '20 10:06 mcpetermohr

@mcpetermohr thanks. I’m running node 10.21 and npm 6.14.5.

I’ll give it a shot with updating. The log it points me to just looks to show the app being terminated unexpectedly. What’s interesting is it’s running cause the web page is available, it just doesn’t find the speakers. I may just wipe and pi and re set it up.

0 info it worked if it ends with ok 1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'prestart', 'start', 'poststart' ] 5 info lifecycle [email protected]~prestart: [email protected] 6 info lifecycle [email protected]~start: [email protected] 7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true 8 verbose lifecycle [email protected]~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 [email protected]~start: CWD: /home/pi/node-sonos-http-api 10 silly lifecycle [email protected]~start: Args: [ '-c', 'node server.js' ] 11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null 12 info lifecycle [email protected]~start: Failed to exec start script 13 verbose stack Error: [email protected] 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 [email protected] 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 [email protected] start: node server.js 22 error Exit status 1 23 error Failed at the [email protected] start script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]

vkoi81 avatar Jun 17 '20 10:06 vkoi81

I upgraded to node/nodejs v14 and everything started to work again. Thanks to everyone for the assistance

mcpetermohr avatar Jun 17 '20 13:06 mcpetermohr

My issue has been resolved. User error. I still had my old bridge connected to router and the Api was looking to discover the speakers through the bridge. Once removed from the network the speakers were discovered. Running mode in debug mode helped me figure this out.

So, just like everyone else, no issues to report with S2 update.

vkoi81 avatar Jun 18 '20 21:06 vkoi81

After I did buy a SONOS Five I did upgrade to S2. Till then presets do not work any more. Whatever I try it does not work. Does anybody have any ideas to solve this? Best Regards

MikeGermany avatar Dec 01 '20 21:12 MikeGermany

After I did buy a SONOS Five I did upgrade to S2. Till then presets do not work any more. Whatever I try it does not work. Does anybody have any ideas to solve this? Best Regards

Run it with NODE_LOG_LEVEL=trace and catch the log just before it crashes. It would also help if you told me if you are running a split system or if everything got upgraded to S2, and also, if you see all players in the /zones output from the API.

jishi avatar Dec 02 '20 17:12 jishi

Hello jishi, thank you very much for your fast response. I did test some more things and discovered, that the installation was defective. This did happen probably due to an unexpected power off. I reinstalled the package and everything is up and running now again :-) I hope Sonos will not change the api.

  • Thanx

MikeGermany avatar Dec 02 '20 18:12 MikeGermany