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

API Does not accept commands if Internet connection was lost #750

Open martin072 opened 4 years ago

martin072 commented 4 years ago

I recently had some unfortunate Internet connection issues with my ISP. One of the side effects was that the API does not respond to, for example, a PLAY command until the sonos device has been used with their own app again.

-> Internet connection lost .. -> Internet connection established -> API command PLAY (or any other) does not work -> Open Sonos App, select a favorite and Play -> Music starts playing -> All API commands now work again

Any idea if there would be a work around for this?

jishi commented 4 years ago

If you are actually selecting a favorite in the Sonos app and start playing, you are actively selecting a source to play, and makes me believe that you lost the source/queue when you lost connectivity with your ISP.

You can't just invoke "Play" if the player doesn't have any source, that is true even for the official controller.

Reasons for the player to loose what source it is playing is either a reboot (which also happens if you have an IP change on the Sonos player) and maybe for some streaming sources when they lost internet connectivity, however they should be few. Spotify for instance shouldn't act that way.

You should be able to query the API to see if it actually has a source, and then decide to queue a favorite or similar before hitting play.

martin072 commented 4 years ago

Thanks. That makes perfect sense! Will dig into that.