Push notifications

  • 28 May 2021
  • 3 replies
  • 113 views

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

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.

 

 

Userlevel 7
Badge +23

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

Userlevel 7
Badge +20

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.