Sonos players are network speakers and amplifiers controlled over the local network (UPnP). The Weble IoT Universal Gateway Sonos driver discovers the Sonos players of the network, shows their state (play state, volume, current and next track) and controls them: play, pause, stop, next, previous and volume.
Typical use: start background music or set the volume from a KNX push button, a scene or the logic module, and show the current track on a visualization.
Driver key:
sonos— listed as Sonos under Building Automation in Gateway driver. Licence: required, contact support@weble.ch. Platforms: Linux and Windows.
1400 of the players reachable from the box.multicast to discover all the players. For a single player in another subnet, choose unicast and enter Device host (and Device port if it is not 1400).You do not create addresses. For each player found, the driver creates the address %sonos:<room> (the room name set in the Sonos app) and its sub-addresses. Open the gateway address table (Devices tab) to see them.
Name, Cluster ID and Description are common to all drivers: see Gateways.
| Label | JSON key | Default | Description |
|---|---|---|---|
| Connection mode | json.mode |
multicast |
multicast: automatic discovery of every player on the network. unicast: direct connection to one player. |
| Device host | json.host |
(empty) | unicast only. IP address or host name of the player. |
| Device port | json.port |
1400 |
unicast only. Port of the player. |
Saving the gateway restarts the driver.
{
"mode": "multicast",
"host": "",
"port": 1400
}
%sonos:<room>[/<function>] — <room> is the room name of the player.
| Sub-address | Value | Writable |
|---|---|---|
%sonos:<room> |
Main address of the player | No |
…/state |
playing, paused or stopped |
No |
…/play |
true while playing |
Yes |
…/pause |
true while paused |
Yes |
…/stop |
true while stopped |
Yes |
…/next, …/previous |
— | Yes |
…/volume, …/volume/current |
Volume, 0 to 100 | volume: yes |
…/volume/set |
Last volume written by the box | Yes |
…/muted, …/muted/current |
Mute status | No |
…/playMode |
Play mode reported by the player | No |
…/track/current |
Current track: object, and one sub-address per field (title, artist, album, albumArtURI, albumArtURL, position, duration, uri, queuePosition) |
No |
…/track/next |
Next track, same fields | No |
Examples:
%sonos:Living Room/volume — write 25 to set the volume to 25 %.%sonos:Kitchen/play — write true to resume playing, false to stop.%sonos:Office/track/current/title — title of the current track.| Label | JSON key | Default | Description |
|---|---|---|---|
| description | description |
(set by the driver) | Free text. |
| log | log |
never | Logging policy, see Log and Store value policies. |
The JSON of the main address (%sonos:<room>) holds the connection data of the player (host, serial number). The driver uses it to reconnect after a restart: do not edit it.
| Property | Value |
|---|---|
| Readable | Yes — updated by the player events |
| Writable | play, pause, stop, next, previous, volume, volume/set |
| Created automatically | Yes — at discovery; addresses cannot be inserted, imported or exported by hand |
| Routable | Yes |
| Loggable | Yes |
| Address | Write | Effect |
|---|---|---|
…/play |
true or 1 |
Resume the current track (or start the queue). |
…/play |
false or 0 |
Stop. |
…/play |
a URI (text), for example the URL of a web radio stream | Play this URI. |
…/pause |
any value | Pause. |
…/stop |
true / false |
Stop / play. |
…/next, …/previous |
any value | Next / previous track. |
…/volume or …/volume/set |
0 to 100 |
Set the volume. |
The player state, volume and tracks are updated by the events of the player, also when it is controlled from the Sonos app.
Route a KNX push button to %sonos:Living Room/play (value 1 = play, 0 = stop), and a KNX dimming value (0-100 %) to %sonos:Living Room/volume.
Display %sonos:Living Room/track/current/title, …/artist and …/albumArtURL in a visualization or a dashboard.
| Symptom | Cause | What to do |
|---|---|---|
Gateway restarts in a loop; log missing license |
No licence for the driver. | Add the licence in Gateways › License manager. |
No player found in multicast |
The players are in another subnet, or multicast is filtered (VLAN, Wi-Fi isolation, IGMP snooping). | Put the box in the subnet of the players, or use unicast with one gateway per player. |
Log Unable to connect to <host>, retry in <n> |
multicast: the player does not answer. |
The driver retries with an increasing delay, up to 60 s. Check that the player is on. |
unicast: gateway stops; log unable to connect to <host>: … - direct mode, no retry, driver stopping |
Wrong Device host or port, or player off. | Check the address and port, then restart the gateway. |
Write fails with Unsupported function |
The sub-address cannot be written. | Write to one of the addresses of section 4. |
To read the driver log: open the gateway log (see Gateways).
muted addresses only show the status.unicast controls one player per gateway.play is written with true or 1 and the current track cannot be played, the driver starts a default web radio stream.