-
-
Notifications
You must be signed in to change notification settings - Fork 14
A.4 Events aka Notifications
Download at: node-red-contrib-sonos-events
You can act on many kind of changes such as new tracks, tv on, playbackstate, volume, mute, group member changes or just use it to show the current state.
There are three categories of events
-
household: covering events related to changes in group, alarms, My Sonos, Music Library updates and more. You can subscribe to any player to receive the household events. Best is to define only one node and to use a link node.
-
group: covering events related to changes in content being played, playback state, group volume/mutestate, and more. To receive group events you MUST subscribe to the coordinator. Any other player in that group might publish none or wrong data!
-
player: covering events related to changes in player volume/mutestate, device properties, audio line in and more. To receive events of a specific player, you must subscribe to this player :-).
In the appendix you find a page showing the different categories.
For each event, there is a one or more trigger (after that, new data will show up) and the data structure (what information is available) being provided.
-
Select "Sonos events" node.
-
In dialog
-
config node field: use the edit button to get in config node edit dialog but leave everything and do update
-
player name: use the search button and select a player
-
events: add ZoneGroupTopology allGroups
-
-
close the node
-
Connect all outputs with a debug node and deploy
-
You should receive the initial event and more in case of changes
[{"id":"76f9f90.911aa08","type":"sonosevents-selection","z":"af7c69f0.7efe08","confignode":"43bd12ff.8ccaec","playerHostname":"192.168.178.35","events":[{"fullName":"ZoneGroupTopologyService.allGroups"}],"outputs":1,"x":950,"y":280,"wires":[["b49dfae8.105e08"]]},{"id":"b49dfae8.105e08","type":"debug","z":"af7c69f0.7efe08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1220,"y":280,"wires":[]},{"id":"43bd12ff.8ccaec","type":"sonosevents-config","name":"household","listenerHostname":"","listenerPort":""}]
Track changes, display group volume, playbackstate mute, art - act on new player - act tv on
In Node-RED use "Import", "Examples" and select the one you would like to use/explore.
Usage: Changes in AVTransportation state (stream, queues, line in, joining a group, tv on/off). processingUnit is calculated from uri.
Target: Coordinator!
Trigger: AVTransportURI, CurrentValidPlayModes, CurrentTransportActions, CurrentValidPlayModes, CurrentPlayMode.
Property | type | Additional information |
---|---|---|
uri |
string |
AVTransportURI - can be used to determine source |
validActions |
string[] |
such as Stop, Next, and more |
validPlayModes |
string[] |
such as SHUFFLE, NORMAL, … |
playMode |
string |
current play mode (for stream always NORMAL) |
processingUnit |
string |
such as queue, stream, joiner, lineIn, tv, app |
Usage: Audio in line is active and playing
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
playbackstate |
boolean |
such as playing, stop, transitioning and more |
Usage: Changes in tracks being played: title, artist, art and more.
Target: Coordinator!
Trigger: EnqueuedTransportURIMetaData.UpnpClass, EnqueuedTransportURIMetaData.Title, CurrentTrackMetaData.Title, CurrentTrackMetaData.Artist, CurrentTrackMetaData.Album, CurrentTrackMetaData.AlbumArtUri but not the playbackstate!
Property | type | Additional information |
---|---|---|
album |
string |
track album |
artist |
string |
track artist |
title |
string |
track title |
artUri |
string |
art uri to retrieve the cover art |
playbackstate |
string |
playing, stopped, .. - |
enqueuedUpnp |
string |
UPnP class - to identify stream/queue |
enqueuedTitle |
string |
title - good to retrieve station information |
Usage: Changes in playbackstate. Keep in mind that transitioning takes place.
Target: Coordinator!
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
playbackstate |
string |
playing, stopped, transitioning |
Usage: Changes to My Sonos (add, delete items).
Target: Any player (all provide the same result)
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
mySonosUpdateId |
string |
id for the new My Sonos version |
Usage: Some devices (Amazon/Google enabled) have a microphone.
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
micEnabled |
boolean |
microphone enabled |
Usage: Use as trigger for split/create stereo pairs.
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
invisible |
boolean |
speaker changes state invisible = true/false |
Usage: Changes in group uuid of the provided player
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
localGroupUuid |
string |
group uuid of this player |
Usage: Changes in group mute state
Target: Coordinator in group - otherwise wrong results
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
groupMutestate |
string |
on or off |
Usage: Changes in group volume
Target: Coordinator in group - otherwise wrong results
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
groupVolume |
string |
range from 0 to 100 |
Usage: Changes regarding the SONOS queue - adding, removing tracks
Target: Coordinator in group - otherwise wrong results
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
updateId |
string |
id of the change |
Usage: Changes in mutestate
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
mutestate |
string |
in range 0 to 100 |
Usage: Changes in volume
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
volume |
string |
in range 0 to 100 |
Usage: Changes in group topology in any group: different members, get standalone, new coordinator and more
Target: Any player - Do not subscribe to multiple player,
Trigger: Any of the properties listed
Property | type | Additional information |
---|---|---|
allGroups |
Array of member[] |
Coordinator always in position 0 |
member.playerName |
string |
SONOS-Playername |
member.url |
string |
url such as http://192.178.178.35:1400 |
member.uuid |
string |
uudi |
member.invisible |
boolean |
useful if paired, bounded |
member.channelMapSet |
string |
useful if paired or bounded |
member.groupName |
string |
node-red-contrib-sonos-plus 2024