node-sonos-http-api
node-sonos-http-api copied to clipboard
API Does not accept commands if Internet connection was lost
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?
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.
Thanks. That makes perfect sense! Will dig into that.