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

PlayPause Action triggers ERROR #796

Open bausi2k opened 3 years ago

bausi2k commented 3 years ago

I really often get those guys, but simply don't have a clue why. It seems to be connected with PlayPause Action, which is triggerd, when I leave my home. Fixed IPs, everything else runs smooth. Maybe because players are grouped?

2021-02-22T06:54:44.658Z ERROR Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control at Object.invoke (/app/node_modules/sonos-discovery/lib/helpers/soap.js:99:10) at Player.pause (/app/node_modules/sonos-discovery/lib/models/Player.js:453:15) at Object.pause (/app/lib/actions/playpause.js:15:29) at handleAction (/app/lib/sonos-http-api.js:117:35) at HttpAPI.requestHandler (/app/lib/sonos-http-api.js:94:21) at /app/server.js:50:13 at Server.finish (/app/node_modules/node-static/lib/node-static.js:111:13) at finish (/app/node_modules/node-static/lib/node-static.js:170:14) at /app/node_modules/node-static/lib/node-static.js:144:17 at FSReqCallback.oncomplete (node:fs:199:21) 2021-02-22T06:54:45.344Z ERROR Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control at Object.invoke (/app/node_modules/sonos-discovery/lib/helpers/soap.js:99:10) at Player.setAVTransport (/app/node_modules/sonos-discovery/lib/models/Player.js:727:15) at /app/node_modules/sonos-discovery/lib/prototypes/SonosSystem/applyPreset.js:128:46 at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:93:5) 2021-02-22T06:54:45.345Z ERROR Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control at Object.invoke (/app/node_modules/sonos-discovery/lib/helpers/soap.js:99:10) at Player.setAVTransport (/app/node_modules/sonos-discovery/lib/models/Player.js:727:15) at /app/node_modules/sonos-discovery/lib/prototypes/SonosSystem/applyPreset.js:128:46 at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:93:5)

jishi commented 3 years ago

Does it actually pause/stop playback?

I know that radios don't actually have a "paused" state, it is shown as a stopped stated if you stop playback, but I'm fairly certain that it should account for that.

However, since this is an error that is responded from the player, are you just blindly invoking playpause to all groups? If any of these groups lacks any kind of source (empty queue or similar) you would receive this error.

bausi2k commented 3 years ago

@jishi thx for explanation - I could reproduced this.

When I leave home, I blindly send a pauseall command and this is the reason. Basically this means nothing to worry. I will implement a function to only stop those that are playing.

I guess this situation confuses the system in a way, because sometimes a speaker is still playing when I come back home.

jishi commented 3 years ago

pauseall should take into consideration which players are actually playing, which it should also remember to allow the "resumeall" call to only resume the players playing prior to pauseall.

If you are getting an error from pauseall, something is broken, if you can figure out instructions how to reliably reproduce it I'll take a look at it.

bausi2k commented 3 years ago

What I found out so far is, that if my Playbase is on TV via optical input, the Pauseall returns an error. I will try to investigate further, if I can find other combinations, where there seems to be a problem.

Owning 5 Sonos speakers in combination with a Loxone Smart Home there are a lot of cases where something can fail :-) thx @jishi