Sonos Player
Contents

1.Description

The "Sonos" environment requires (per project) the following nodes:
  • Exactly one 18171 gateway node
  • At least one and a maximum of eight 18172 Sonos player nodes (this node)
The environment settings are made in the gateway. The control of the Sonos boxes takes place via the Sonos player components.

With one player node each, it is possible to select and control presets created with the Sonos app for a Sonos box or a group of boxes.
The use of these nodes generates at least two accessible endpoints (URLs) on the HomeServer/FacilityServer. The URL can be used to configure which presets can be used in the player. Each used preset is also assigned a unique sequence number, which sets a song order that can be changed by the user.
The other URLs control the players, i.e. there is one URL per player component used.
Important
Note that with this node, the inputs 2, 3 and 4 only have to be assigned with fixed values. It is not possible to connect C objects to these inputs!

1.1.Naming conventions

  • Preset: A preset can only be created via the Sonos app. It can contain data for one of four source types. This documentation deals only with the source types "Sonos Playlist" and "Radio Station".
    Important
    Check that no duplicated entries are created in a preset, as this can impair the function of the node.
  • Playlist: A (Sonos) playlist is a list of songs stored locally, usually ".mp3" files.
  • Radio Station: A radio station accessible via the Internet.

1.2.Configuration page

For information on the configuration page, see here.

2.Inputs

No.NameInitialisationDescription
1Sonos Gateway0
Must be connected to the "Sonos Player" output of the 18171 Sonos gateway node.
2IP address""
This is the IP address of the Sonos box to be controlled with this node.
Important
Must be entered as a fixed value in the input!
3Group0
The group no. identifies the Sonos box to be controlled. If a successful connection is made, a 1 is displayed on Output 13 (playback device connected).
The Sonos app allows multiple boxes to be grouped together. The master box can then be controlled via a Sonos player node.
In an HS/FS project, each of the maximum of eight Sonos player nodes must have a different group number from 1 to 8, whereby the first block used must be assigned to Group 1.
Important
Must be entered as a fixed value in the input!
4Play0
A preset is selected
  • Receives 1 at the input
    • Playlist:
      • Starts or resumes playback.
      • Displays a 1 on Output 1 (playback state).
      • Displays a 0 on Output 2 (pause state).
    • Radio Station:
      • Resumes playback.
      • Displays a 1 on Output 1 (playback state).
      • Displays a 0 on Output 3 (stop state).
  • Receives 0 at the input
    • Playlist:
      • Pauses the playback.
      • Displays a 0 on Output 1 (playback state).
      • Displays a 1 on Output 2 (pause state).
    • Radio Station:
      • Stops the playback.
      • Displays a 0 on Output 1 (playback state).
      • Displays a 1 on Output 3 (stop state).
No preset is selected
  • Receives 1 at the input
    • Starts the first preset available on the configuration page.
    • If this preset is a playlist:
      • Starts playback of the song set as the first song.
    • If this preset is a radio station:
      • Begins playback.
    • In both cases (regardless of the source type of the preset):
      • Displays a 1 on Output 1 (playback state).
      • Displays a 0 on Output 3 (stop state).
      • Displays the current number of the preset on Output 6 (current playlist).
      • If available: Displays the song title on Output 9.
      • If available: Displays the artist's name on Output 10.
      • If available: Displays the album title on Output 11.
      • Displays the name of the preset on Output 12 (playlist name).
      • If available: Displays the cover art URI on Output 16.
  • Receives 0 at the input
    • Displays a 3 on Output 14 (Last Error (numeric)).
    • Displays the text associated with error 3 on Output 15 (Last error (text)).
5Pause0
A preset is selected
  • Receives 1 at the input
    • Playlist:
      • Pauses the playback.
      • Displays a 0 on Output 1 (playback state).
      • Displays a 1 on Output 2 (pause state).
    • Radio Station:
      • Stops the playback.
      • Displays a 0 on Output 1 (playback state).
      • Displays a 1 on Output 3 (stop state).
  • Receives 0 at the input
    • Playlist:
      • Starts or resumes playback.
      • Displays a 1 on Output 1 (playback state).
      • Displays a 0 on Output 2 (pause state).
    • Radio Station:
      • Resumes playback.
      • Displays a 1 on Output 1 (playback state).
      • Displays a 0 on Output 3 (stop state).
No preset is selected
  • Receives 1 at the input
    • Displays a 3 on Output 14 (Last Error (numeric)).
    • Displays the text associated with error 3 on Output 15 (Last error (text)).
  • Receives 0 at the input
    • Starts the first preset available on the configuration page.
    • If this preset is a playlist:
      • Starts playback of the song set as the first song.
    • If this preset is a radio station:
      • Begins playback.
    • In both cases (regardless of the source type of the preset):
      • Displays a 1 on Output 1 (playback state).
      • Displays a 0 on Output 3 (stop state).
      • Displays the current number of the preset on Output 6 (current playlist).
      • If available: Displays the song title on Output 9.
      • If available: Displays the artist's name on Output 10.
      • If available: Displays the album title on Output 11.
      • Displays the name of the preset on Output 12 (playlist name).
      • If available: Displays the cover art URI on Output 16.
6Stop0
A preset is selected
  • Receives 1 at the input
    • Playlist:
      • Stops the playback.
      • Displays a 0 on Output 1 (playback state).
      • Displays a 1 on Output 3 (stop state).
      • Displays a 0 on Output 6 (current playlist).
      • Displays an empty string on Output 9 (song title).
      • Displays an empty string on Output 10 (artist).
      • Displays an empty string on Output 11 (album).
      • Displays "unsaved list" on Output 12 (playlist name).
    • Radio Station:
      • Stops the playback.
      • Displays a 0 on Output 1 (playback state).
      • Displays a 1 on Output 3 (stop state).
  • Receives 0 at the input
    • Playlist:
      • Starts or resumes playback.
      • Displays a 1 on Output 1 (playback state).
      • Displays a 0 on Output 2 (pause state).
    • Radio Station:
      • Resumes playback.
      • Displays a 1 on Output 1 (playback state).
      • Displays a 0 on Output 3 (stop state).
No preset is selected
  • Receives 1 at the input
    • Nothing happens.
  • Receives 0 at the input
    • Starts the first preset available on the configuration page.
    • If this preset is a playlist:
      • Starts playback of the song set as the first song.
    • If this preset is a radio station:
      • Begins playback.
    • In both cases (regardless of the source type of the preset):
      • Displays a 1 on Output 1 (playback state).
      • Displays a 0 on Output 3 (stop state).
      • Displays the current number of the preset on Output 6 (current playlist).
      • If available: Displays the song title on Output 9.
      • If available: Displays the artist's name on Output 10.
      • If available: Displays the album title on Output 11.
      • Displays the name of the preset on Output 12 (playlist name).
      • If available: Displays the cover art URI on Output 16.
7Volume control0
Adjusts the volume to a specific level.
  • Waits for a percentage.
  • Displays the set value on Output 4 (volume level).
8Relative volume control0
Controls the volume relative to the current value.
  • 0 = Stop
  • 1 = turn down 100%
  • 2 = turn down 50%
  • 3 = turn down 25%
  • 4 = turn down 12.5%
  • 5 = turn down 6.25%
  • 6 = turn down 3.125%
  • 7 = turn down 1.6%
  • 8 = Stop
  • 9 = turn up 100%
  • 10 = turn up 50%
  • 11 = turn up 25%
  • 12 = turn up 12.5%
  • 13 = turn up 6.25%
  • 14 = turn up 3.125%
  • 15 = turn up 1.6 %
9Volume control louder/quieter0
Adjusts the volume in 5% increments.
  • Receives a 1: Volume + 5%.
  • Receives a 0: Volume - 5%.
  • Displays the new volume level on Output 4 (volume level).
10Muting0
The audio output is disabled
  • Has no function if the option "never mute" was activated for the currently-playing preset on the configuration page.
  • A 1 on this input activates the mute option.
  • A 0 on this input deactivates the mute option.
  • The current state is displayed on Output 5 (mute).
  • There are no changes made to the volume level (Output 4)!
11Next/previous track0
Applies to playlists only. Does not apply to radio stations.
  • Playlist:
    • If the current track is the last/first on the playlist:
      • If there is a 1 on Input 15 (repeat all):
        • If there is a 1 on Input 14 (shuffle playback): Starts playing a random track.
        • If there is a 0 on Input 14 (shuffle playback): Starts playing the first/last track.
      • If there is a 0 on Input 15 (repeat all):
        • Current playback is not interrupted.
        • Displays a 3 on Output 14 (Last Error (numeric)).
        • Displays the text associated with error 3 on Output 15 (Last error (text)).
    • If the current track is not the last/first on the playlist:
      • If there is a 1 on Input 14 (shuffle playback): Starts playing a random track.
      • If there is a 0 on Input 14 (shuffle playback): Starts playing the next/previous track.
12Next/Previous playlist0
  • If the current preset is the last/first preset:
    • If there is a 1 on Input 14 (shuffle playback):
      • If the first/last preset is a playlist: Starts playing a random track from the first/last playlist.
      • If the first/last preset is a radio station: ööö ?
    • If there is a 0 on Input 14 (shuffle playback):
      • If the first/last preset is a playlist: Starts playing the track of the first/last playlist set as the start track.
      • If the first/last preset is a radio station: Starts playing the first/last radio station.
  • If the current preset is not the last/first preset:
    • If there is a 1 on Input 14 (shuffle playback):
      • If the next/previous preset is a playlist: Starts playing a random track from the next/previous playlist.
      • If the next/previous preset is a radio station: ööö ?
    • If there is a 0 on Input 14 (shuffle playback):
      • If the next/previous preset is a playlist: Starts playing the track of the next/previous playlist set as the start track.
      • If the next/previous preset is a radio station: Starts playing the next/previous radio station.
13Playlist selection0
  • If there is a 1 on Input 14 (shuffle playback):
    • If the selected preset is a playlist: Starts playing a random track from the selected playlist.
    • If the selected preset is a radio station: Starts playing the selected radio station.
  • If there is a 0 on Input 14 (shuffle playback):
    • If the selected preset is a playlist: Starts playing the track of the selected playlist set as the start track.
    • If the selected preset is a radio station: Starts playing the selected radio station.
14Shuffle0
Arranges the tracks of a playlist in a random order.
  • Does not apply to radio stations.
  • Does not apply to the order of the presets.
  • A 1 on this input activates the shuffle option.
  • A 0 on this input activates the shuffle option.
  • The current state is displayed on Output 7.
15Repeat All0
All tracks on a playlist are repeated.
  • Does not apply to radio stations.
  • If there is a 1 on Input 14 (shuffle playback): After a full run through the current playlist, another run is started in the same order.
  • A 1 on this input activates the repeat option.
  • A 0 on this input activates the repeat option.
  • The current state is displayed on Output 8.
16Exit slave mode0
If the box controlled by the node is in slave mode, a 1 will be displayed upon receipt.
  • Has no effect when the box is in "master" mode.

3.Outputs

No.NameInitialisationSBCDescription
1Playback status0s
1 - Preset is played.
0 - No output is played.
2Pause status0s
1 - No output is played.
3Stop status0s
1 - No output is played.
4Volume status0s
Percentage of the currently set volume.
5Mute status0s
1 - No audio output is played. Something can still be played.
6Current playlist0s
Current number of the current preset or 0 (not selected for any preset).
7Shuffle status0s
1 - Shuffle playback is ENABLED.
0 - Shuffle playback is DISABLED.
8"Repeat all" playback mode0s
1 - Playback mode is set to "Repeat All".
0 - Playback mode is set to "No Repeat".
9Song Title""s
If the information is available, the name of the currently-playing track will be displayed.
An output only takes place when the output value is changed.
10Artist""s
If the information is available, the artist of the currently-playing track will be displayed.
An output only takes place when the output value is changed.
11Album""s
If the information is available, the album title of the currently-playing track will be displayed.
An output only takes place when the output value is changed.
12Playlist name""s
Name of the currently-playing preset. If no preset is currently selected, neither an empty string nor an 'unsaved playlist' is displayed.
An output only takes place when the output value is changed.
13Playback device connected0s
Updated when starting the binary. Set to 1 if the Sonos box controlled by this node is available.
14Last Error (numeric)0s
Error code of the last error. Set to 0 if an action could be performed properly.
15Last error (text)""s
Text of the error message whose code is displayed on Output 14. Set to "" if the error code is 0.
16CoverArtURI""s
If the information is available, a URL will be displayed directing the user to the cover image of the currently-playing album.
17Room name""s
Displays the name given in the Sonos app for the controlled box.
18Sonos group slave status0s
Displays a 1 if the controlled box is externally controlled by a box other than "slave".
19Shuffle allowed0s
Displays a 1 if the function "Play" is allowed to be executed.
20Repeat all allowed0s
Displays a 1 if the function "Pause" is allowed to be executed.
21Play allowed0s
Displays a 1 if the function "Stop" is allowed to be executed.
22Pause allowed0s
Displays a 1 if the function "Next Track" is allowed to be executed.
23Stop allowed0s
Displays a 1 if the function "Previous Track" is allowed to be executed.
24Next track allowed0s
Displays a 1 if the function "Shuffle Playback" is allowed to be activated.
25Previous track allowed0s
Displays a 1 if the function "Repeat All" is allowed to be activated.
s = send, sbc = send by change

4.Other

Recalculation during start:Yes
Module is retentive:No
Internal designation:18172
Category:Sonos

5.Similar functions

Sonos Gateway