Block music system Sonos| The function block integrates one room of a Sonos
system: playback, volume, mute, sound, Sonos favorites, Sonos playlists, line-in and TV input,
plus several rooms playing together. The controller talks to the speakers directly in the
home network – no Sonos account, no internet and no additional software. Create one function block per room. The IP address is not needed: the controller searches the network for the Sonos system itself, and Select speaker in the parameter dialog picks the speaker from a list. Its serial number stays the same when the room is renamed in the Sonos app or the speaker gets a new IP address. The speaker can also be selected in the control, in the System dialog. The IP address is only needed if the search of the network does not get through, for example with a separate network for the speakers. All function blocks with the same IP address then share one connection; a speaker that is connected by network cable is best suited. The speakers report every change to the controller themselves (port 1411, up to 1420 if taken). If this path is blocked, for example by a firewall or a separate network for the speakers, the controller polls the state every 5 seconds; the diagnostics then show a note. The matching control is Block music system Sonos. Sound, volume limits, alarm and presence are set there. Title, cover and favorites come directly from the system and are not on any output. Announcements and chimes are offered by the function block Sonos (local); both function blocks can be used side by side. |
| 1. Create the function block, connect to the controller and
click Select speaker in the parameter dialog. The controller searches the network for
speakers; a double click on the room enters the serial number and the room.
Alternatively enter the serial number (label on the device, Sonos app under "About My
Sonos System") or the name of the room by hand. 2. Generate addresses: all inputs except brightness and all outputs are created. 3. Drag the control onto the page and link it to the function block with a right click. The speaker is looked up in this order: the choice in the control (System dialog), the serial number, the room name, the speaker found last time (so a renamed room can still be found), the IP address and finally the only room of a system. If a serial number or room name is entered and cannot be found, the function block does not take any other speaker; the diagnostics then show a message with the names of all rooms of the system. |
Inputs |
||
| ZE | Zone on/off | Optional. Not 0 starts playback, 0 stops it. A room that follows another one in a group leaves the group when switched off; otherwise the whole group stops. If the room starts from standstill, the speaker keeps its volume unless a fixed start volume is set in the control. If there is nothing to play, the first Sonos favorite starts. Every write telegram is evaluated, with a drawn connection the change. Not linked: switching only via the control, switching times and presence. |
| LP | Volume percent | Optional. Volume 0…100 %, limited to the maximum volume. A value above 0 cancels mute. In a group the value applies to this room only. Not linked: no effect. |
| LD | Volume 4 bit | Optional. Relative adjustment (DPT 3.007): bit 3 = louder, bits 0…2 the step size (1 = 100 % to 7 = 1.5 %), 0 = stop. The volume changes in steps of 2 % every 0.3 seconds up to the limit. Not linked: no effect. |
| ST | Mute | Optional. Not 0 mutes, 0 unmutes. Every write telegram is evaluated. Not linked: no effect. |
| PL | Play | Optional. Resumes playback. Every write telegram with a value other than 0 is evaluated, with a drawn connection the change to not 0. In a group the command acts on the whole group. Not linked: no effect. |
| PA | Pause | Optional. Pauses playback, evaluated like PL. A radio station that cannot pause is stopped. No effect without playback and on inputs. Not linked: no effect. |
| VT | Previous track | Optional. Previous track, evaluated like PL. Whether a service can go back is up to the service. Not linked: no effect. |
| NT | Next track | Optional. Next track, evaluated like PL. Not linked: no effect. |
| FV | Favorite | Optional. Starts the Sonos favorite with this number (1…), 0 does nothing. The number of a favorite stays the same: a new favorite gets the next free number and shifts no existing one; the numbers of deleted favorites are not reused. At first the numbers follow the order of the Sonos favorites in the Sonos app. The numbers are shown in the favorites list of the control (Source). Shortcuts from Sonos Radio (for example “Trending now”) can only be started in the app; they are missing from the list and are not counted. Every write telegram is evaluated. Not linked: no effect. |
| SC | Sleep minutes | Optional. Stops the room after this time, 0 cancels. A stopped room starts. The sleep timer also ends when the room is stopped otherwise and does not survive a restart of the controller. Not linked: only via the control. |
| HE | Brightness | Optional. Brightness in lux for the condition When bright / When dark of switching times and presence. Not linked: the condition is not offered, switching times and presence always act. |
| LA | Volume up 1 bit | Optional. Every pulse (value not 0) raises the volume by the step size of the parameter, at most up to the maximum volume; a muted room becomes audible again. Only acts on a room that is playing or paused. Every write telegram is evaluated. Not linked: no effect. |
| LE | Volume down 1 bit | Optional. Every pulse (value not 0) lowers the volume by the step size, at most down to 0. Otherwise like LA. |
| ZF | Shuffle | Optional. Not 0 switches shuffle on, 0 off. The mode applies to the whole group. Radio and line inputs do not know shuffle; nothing happens there. Not linked: no effect. |
| WH | Repeat | Optional. Not 0 repeats playback, 0 switches repeat off. If the room is set to "repeat one title", this is kept. Otherwise like ZF. |
Outputs |
||
| SZ | Status zone | 1 = the room is playing or paused, 0 = it is stopped. |
| SL | Status volume | Volume of the room in percent. |
| SS | Status mute | 1 = the room is muted. |
| SP | Playing | 1 = the room is currently playing. |
| VB | Connected | 1 = the system is reachable and the room is known there. |
| GR | Group member | 1 = the room follows another room in a group, 0 = it plays on its own or leads the group. |
| SR | Sleep remaining | Remaining sleep time in minutes, 0 = off. |
| TX | Title text | What is playing as one text, for example for a display switch: "Artist - Title", for radio the station, for a line input its name. Empty when the room is stopped. The text can change without the room doing anything, for example with radio. |
| SF | Status shuffle | 1 = shuffle is on, also when it was switched in the Sonos app. |
| WD | Status repeat | 1 = playback is repeated (all or one title). |
Parameter |
||
| Select speaker | The controller searches the network for Sonos speakers and shows them with room, IP address and serial number. The selection enters the serial number and the room and clears the IP address. Studio must be connected to the controller; no project is needed. | |
| IP address | Optional. Only needed if the controller does not find the system itself in the network. Address of a Sonos speaker of the system; if it does not answer, the controller tries the other speakers it last knew. Empty: the controller searches the network for the system, serial number or room name select the speaker. | |
| Room | Optional. Name of the room as in the Sonos app, case does not matter. Once the function block has found the speaker, it finds it again after the room is renamed (as long as serial number and room are entered unchanged). | |
| Serial number | Optional. Serial number of the speaker, for example 5C-AA-FD-54-62-9A. It is on the label of the device and in the Sonos app under "About My Sonos System"; a check character at the end (:B) is not needed. It can be entered with or without hyphens and colons. The serial number takes precedence over the room name and stays the same when the room is renamed. For a stereo pair the serial number of the speaker that appears as the room in the Sonos app applies. | |
| Step volume up/down (%) | Step size of the inputs LA and LE in percent, 1…20. Default 5. | |
| Debug | Writes commands, subscriptions and polling errors to the diagnostics. | |