I was wondering, is there a way to get a push notification of currently playing track to my raspberry pi device in my local lan?
I haven’t done any programing using the Sonos API, but it looks like you can subscribe to events. That sounds like it would essentially accomplish the push notification you’re looking for, although not exactly a notification.
https://developer.sonos.com/reference/control-api/playback-metadata/metadata-status/
There are other events you can subscribe to, but you obviously need to have skills in order to write code on the rasberry Pi side of things. Others on this side may have done it before, or know of existing code that already does what you want. I haven’t played around with this myself.
Subscribe to the UPnP event on the AVTransport service, on the speaker that is the group coordinator. Job done. (Well you have to parse the xml, but duh).
To make it easier, you could use the SoCo Python library, or (even easier) SoCo-CLI.
If using the latter, take a look at the ‘wait_end_track’ action, followed by the ‘track’ action.
These are local network utilities, and don’t require registration with the Sonos cloud API.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.