Overview SONOS (local)



This function block controls SONOS speakers directly over the network. Control is performed locally using the Sonos network protocol (UPnP) — no additional software and no cloud connection is required.

The speakers are discovered automatically on the network. Zones are addressed by their room name (exactly as shown in the Sonos app). If speakers are grouped, playback functions (Play, Pause, Next, ...) affect the whole group, while volume and mute affect the individual speaker.

If zone names are changed or groups are rearranged in the Sonos app, this is adopted automatically (refresh approx. every 5 minutes, immediately after a failed command). Restarting the controller also takes effect immediately.

The Text to Speech function uses an external service (Google) which is currently free of charge. If this changes in the future, a different service has to be used. We have no influence on this and therefore this function cannot be guaranteed. Once generated, announcements are stored locally and do not require internet access on subsequent calls.


Inputs

TR
Trigger
Trigger for execution

Outputs

ER
Error
Error of the last command: 1 = command could not be executed (zone not found, speaker not reachable, Text to Speech failed), 0 = last command successful.

Parameters


Zone name
Name of the zone. The name must be entered exactly as shown in the SONOS app.

Function
Function to execute
  • Play
  • Pause
  • Play/Pause
  • Mute
  • Unmute
  • Next
  • Previous
  • Volume Inc.
  • Volume Dec.
  • Volume val., data field is 0-100
  • Volume abs., data field is 0-100
  • Favorites, data field is the name
  • Playlist, data field is the name
  • Text to Speech., data field is "Text/language code/volume", for example "Lunch is ready/en/50" announces the text "Lunch is ready" in English (en) at 50% volume. If "sayall" is entered as the zone name, the text is announced on all speakers. The current playback is interrupted for the announcement and resumed automatically afterwards. The text may be up to approx. 200 characters long.

Note: With "Volume val." the volume setpoint is provided via the input, therefore the trigger must be set to All telegrams.


Trigger
  • 0->1 rising edge
  • 1->0 falling edge
  • Telegram

Data
Optional data. E.g. the name of the favorite when Favorites is selected.

Debug
Only when enabled, the controller outputs additional debug messages in the messages (e.g. discovered speakers, executed commands). Errors are always reported.

Updating existing projects

Old SONOS blocks (the variant using external additional software) that are still part of the project can continue to be used and will keep working. However, the old block can no longer be added to a project.

When the project is edited, the old blocks should be replaced by this new variant: no external software is required any more and more resources become available on the controller.

How to replace:

Network functions

The block uses the following network mechanisms:

Important: Speakers and controller should be in the same network (subnet). If they are separated by a router, a VLAN or a guest network, problems can occur: the automatic discovery does not find any speakers (multicast is not routed), NAT or firewall rules can block the control connections, and for Text to Speech the speakers cannot reach the controller. Devices with "IGMP snooping" (some switches) or wireless access points with client isolation enabled can also prevent the discovery or the control.

FAQ - what to test in case of problems



See also the common parameters of all function blocks.