Documentation

ControllerInterface extends SpeakerInterface

Allows interaction with the groups of speakers.

Although sometimes a Controller is synonymous with a Speaker, when speakers are grouped together only the coordinator can receive events (play/pause/etc)

Table of Contents

Methods

addSpeaker()  : $this
Adds the specified speaker to the group of this Controller.
adjustVolume()  : $this
Adjust the volume of this speaker by a relative amount.
exportState()  : ControllerStateInterface
Grab the current state of the Controller (including it's queue and playing attributes).
getBass()  : int
Get the bass equalisation level.
getCrossfade()  : bool
Check if crossfade is currently active.
getGroup()  : string
Get the uuid of the group this speaker is a member of.
getIndicator()  : bool
Check whether the indicator light is on or not.
getIp()  : string
Get the IP address of this speaker.
getLoudness()  : bool
Check whether loudness normalisation is on or not.
getMediaInfo()  : array<string, string>
Get the currently active media info.
getMode()  : array<string, bool>
Get the current play mode settings.
getName()  : string
Get the "Friendly" name of this speaker.
getQueue()  : QueueInterface
Get the queue for this controller.
getRepeat()  : bool
Check if repeat is currently active.
getRoom()  : string
Get the room name of this speaker.
getShuffle()  : bool
Check if shuffle is currently active.
getSpeakers()  : array<string|int, SpeakerInterface>
Get the speakers that are in the group of this controller.
getState()  : PlayState
Get the current state of the group of speakers.
getStateDetails()  : StateInterface
Get attributes about the currently active track in the queue.
getStateName()  : string
Get the current state of the group of speakers as the string reported by sonos: PLAYING, PAUSED_PLAYBACK, etc
getTreble()  : int
Get the treble equalisation level.
getUuid()  : string
Get the uuid of this speaker.
getVolume()  : int
Get the current volume of this speaker.
interrupt()  : $this
Interrupt the current audio with a track.
isCoordinator()  : bool
Check if this speaker is the coordinator of it's current group.
isMuted()  : bool
Check if this speaker is currently muted.
isStreaming()  : bool
Check if this controller is currently playing a stream.
isUsingQueue()  : bool
Check if this controller is currently using its queue.
mute()  : $this
Mute this speaker.
next()  : self
Skip to the next track in the current queue.
pause()  : self
Pause the group.
play()  : self
Start playing the active music for this group.
previous()  : self
Skip back to the previous track in the current queue.
removeSpeaker()  : $this
Removes the specified speaker from the group of this Controller.
restoreState()  : $this
Restore the Controller to a previously exported state.
seek()  : $this
Seeks to a specific position within the current track.
selectTrack()  : $this
Skip to the specific track in the current queue.
setBass()  : $this
Set the bass equalisation.
setCrossfade()  : $this
Turn crossfade on or off.
setGroup()  : void
Set which group this speaker belongs to.
setIndicator()  : $this
Turn the indicator light on or off.
setLoudness()  : $this
Set whether loudness normalisation is on or not.
setMode()  : $this
Set the current play mode settings.
setRepeat()  : $this
Turn repeat mode on or off.
setShuffle()  : $this
Turn shuffle mode on or off.
setState()  : self
Set the state of the group.
setTreble()  : $this
Set the treble equalisation.
setVolume()  : $this
Adjust the volume of this speaker to a specific value.
unmute()  : $this
Unmute this speaker.
updateGroup()  : void
Remove any previously established group for this speaker.
useLineIn()  : $this
Play a line-in from a speaker.
useQueue()  : $this
Set this controller to use its queue (rather than a stream).
useStream()  : $this
Play a stream on this controller.

Methods

adjustVolume()

Adjust the volume of this speaker by a relative amount.

public adjustVolume(int $adjust) : $this
Parameters
$adjust : int

The amount to adjust by between -100 and 100

Return values
$this

getBass()

Get the bass equalisation level.

public getBass() : int
Return values
int

getCrossfade()

Check if crossfade is currently active.

public getCrossfade() : bool
Return values
bool

getIndicator()

Check whether the indicator light is on or not.

public getIndicator() : bool
Return values
bool

getIp()

Get the IP address of this speaker.

public getIp() : string
Return values
string

getLoudness()

Check whether loudness normalisation is on or not.

public getLoudness() : bool
Return values
bool

getMediaInfo()

Get the currently active media info.

public getMediaInfo() : array<string, string>
Return values
array<string, string>

getMode()

Get the current play mode settings.

public getMode() : array<string, bool>
Return values
array<string, bool>

An array with 2 elements (shuffle and repeat)

getName()

Get the "Friendly" name of this speaker.

public getName() : string
Return values
string

getRepeat()

Check if repeat is currently active.

public getRepeat() : bool
Return values
bool

getRoom()

Get the room name of this speaker.

public getRoom() : string
Return values
string

getShuffle()

Check if shuffle is currently active.

public getShuffle() : bool
Return values
bool

getStateName()

Get the current state of the group of speakers as the string reported by sonos: PLAYING, PAUSED_PLAYBACK, etc

public getStateName() : string
Return values
string

getTreble()

Get the treble equalisation level.

public getTreble() : int
Return values
int

getUuid()

Get the uuid of this speaker.

public getUuid() : string
Return values
string

getVolume()

Get the current volume of this speaker.

public getVolume() : int
Return values
int

interrupt()

Interrupt the current audio with a track.

public interrupt(UriInterface $track[, int|null $volume = null ]) : $this

The current state of the controller is stored, the passed track is played, and then when it has finished the previous state of the controller is restored. This is useful for making announcements over the Sonos network.

Parameters
$track : UriInterface

The track to play

$volume : int|null = null

The volume to play the track at

Return values
$this

isCoordinator()

Check if this speaker is the coordinator of it's current group.

public isCoordinator() : bool
Return values
bool

isMuted()

Check if this speaker is currently muted.

public isMuted() : bool
Return values
bool

isStreaming()

Check if this controller is currently playing a stream.

public isStreaming() : bool
Return values
bool

isUsingQueue()

Check if this controller is currently using its queue.

public isUsingQueue() : bool
Return values
bool

mute()

Mute this speaker.

public mute([bool $mute = true ]) : $this
Parameters
$mute : bool = true

Whether the speaker should be muted or not

Return values
$this

next()

Skip to the next track in the current queue.

public next() : self
Return values
self

play()

Start playing the active music for this group.

public play() : self
Return values
self

previous()

Skip back to the previous track in the current queue.

public previous() : self
Return values
self

selectTrack()

Skip to the specific track in the current queue.

public selectTrack(int $position) : $this
Parameters
$position : int

The zero-based position of the track to skip to

Return values
$this

setBass()

Set the bass equalisation.

public setBass(int $bass) : $this
Parameters
$bass : int

The bass level (between -10 and 10)

Return values
$this

setCrossfade()

Turn crossfade on or off.

public setCrossfade(bool $crossfade) : $this
Parameters
$crossfade : bool

Whether crossfade should be on or not

Return values
$this

setGroup()

Set which group this speaker belongs to.

public setGroup(string $group) : void
Parameters
$group : string

setIndicator()

Turn the indicator light on or off.

public setIndicator(bool $on) : $this
Parameters
$on : bool

Whether the indicator should be on or off

Return values
$this

setLoudness()

Set whether loudness normalisation is on or not.

public setLoudness(bool $on) : $this
Parameters
$on : bool

Whether loudness should be on or not

Return values
$this

setMode()

Set the current play mode settings.

public setMode(array<string, bool> $options) : $this
Parameters
$options : array<string, bool>

An array with 2 elements (shuffle and repeat)

Return values
$this

setRepeat()

Turn repeat mode on or off.

public setRepeat(bool $repeat) : $this
Parameters
$repeat : bool

Whether repeat should be on or not

Return values
$this

setShuffle()

Turn shuffle mode on or off.

public setShuffle(bool $shuffle) : $this
Parameters
$shuffle : bool

Whether shuffle should be on or not

Return values
$this

setTreble()

Set the treble equalisation.

public setTreble(int $treble) : $this
Parameters
$treble : int

The treble level (between -10 and 10)

Return values
$this

setVolume()

Adjust the volume of this speaker to a specific value.

public setVolume(int $volume) : $this
Parameters
$volume : int

The amount to set the volume to between 0 and 100

Return values
$this

unmute()

Unmute this speaker.

public unmute() : $this
Return values
$this

updateGroup()

Remove any previously established group for this speaker.

public updateGroup() : void

useLineIn()

Play a line-in from a speaker.

public useLineIn([SpeakerInterface|null $speaker = null ]) : $this

If no speaker is passed then the current controller's is used.

Parameters
$speaker : SpeakerInterface|null = null

The speaker to get the line-in from

Return values
$this

useQueue()

Set this controller to use its queue (rather than a stream).

public useQueue() : $this
Return values
$this

useStream()

Play a stream on this controller.

public useStream(Stream $stream) : $this
Parameters
$stream : Stream

The Stream object to play

Return values
$this
On this page

Search results