Skip to main content
Avid Contributor I
May 28, 2021

Push notifications

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?

This topic has been closed for further comments. You can use the search bar to find a similar topic, or create a new one by clicking Create Topic at the top of the page.

3 replies

melvimbe
May 28, 2021

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.

 

 

Danny
controlav
Lead Maestro
May 28, 2021

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).

Author of the leading independent Sonos apps for Android, MacOS, iOS, Windows and Xbox.
pwt
Virtuoso
May 30, 2021

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.

4 x P:5 | Sub | 4 x P:1 | 3 x Connect | 2 x Boost | Connect:Amp | 2 x One | Amp | Move | Port | Era 300