Speaker
in package
implements
SpeakerInterface
Represents an individual Sonos speaker, to allow volume, equalisation, and other settings to be managed.
Table of Contents
Interfaces
- SpeakerInterface
- Represents an individual Sonos speaker, to allow volume, equalisation, and other settings to be managed.
Properties
- $coordinator : bool
- $device : DeviceInterface
- $group : string|null
- $ip : string
Methods
- __construct() : mixed
- Create an instance of the Speaker class.
- adjustVolume() : $this
- Adjust the volume of this speaker by a relative amount.
- getBass() : int
- Get the bass equalisation level.
- 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.
- getName() : string
- Get the "Friendly" name of this speaker.
- getRoom() : string
- Get the room name of this speaker.
- getTreble() : int
- Get the treble equalisation level.
- getUuid() : string
- Get the uuid of this speaker.
- getVolume() : int
- Get the current volume of this speaker.
- isCoordinator() : bool
- Check if this speaker is the coordinator of it's current group.
- isMuted() : bool
- Check if this speaker is currently muted.
- mute() : $this
- Mute this speaker.
- setBass() : $this
- Set the bass equalisation.
- 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.
- setTreble() : $this
- Set the treble equalisation.
- setVolume() : $this
- Adjust the volume of this speaker to a specific value.
- soap() : SoapResponse
- unmute() : $this
- Unmute this speaker.
- updateGroup() : void
- Remove any previously established group for this speaker.
- lookupTopology() : void
- Ensure we've determined this speaker's topology.
- setEqLevel() : $this
- Set the bass/treble equalisation level.
Properties
$coordinator
private
bool
$coordinator
= false
Whether this speaker is the coordinator of its group or not.
$device
private
DeviceInterface
$device
The instance of the Device class to send requests to.
$group
private
string|null
$group
= null
The group id this speaker is a part of.
$ip
private
string
$ip
The IP address of the speaker.
Methods
__construct()
Create an instance of the Speaker class.
public
__construct(DeviceInterface|string $param) : mixed
Parameters
- $param : DeviceInterface|string
-
An Device instance or the ip address that the speaker is listening on
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
$thisgetBass()
Get the bass equalisation level.
public
getBass() : int
Return values
intgetGroup()
Get the uuid of the group this speaker is a member of.
public
getGroup() : string
Tags
Return values
stringgetIndicator()
Check whether the indicator light is on or not.
public
getIndicator() : bool
Return values
boolgetIp()
Get the IP address of this speaker.
public
getIp() : string
Return values
stringgetLoudness()
Check whether loudness normalisation is on or not.
public
getLoudness() : bool
Return values
boolgetName()
Get the "Friendly" name of this speaker.
public
getName() : string
Return values
stringgetRoom()
Get the room name of this speaker.
public
getRoom() : string
Return values
stringgetTreble()
Get the treble equalisation level.
public
getTreble() : int
Return values
intgetUuid()
Get the uuid of this speaker.
public
getUuid() : string
Return values
stringgetVolume()
Get the current volume of this speaker.
public
getVolume() : int
Return values
intisCoordinator()
Check if this speaker is the coordinator of it's current group.
public
isCoordinator() : bool
Return values
boolisMuted()
Check if this speaker is currently muted.
public
isMuted() : bool
Return values
boolmute()
Mute this speaker.
public
mute([bool $mute = true ]) : $this
Parameters
- $mute : bool = true
-
Whether the speaker should be muted or not
Return values
$thissetBass()
Set the bass equalisation.
public
setBass(int $bass) : $this
Parameters
- $bass : int
-
The bass level (between -10 and 10)
Return values
$thissetGroup()
Set which group this speaker belongs to.
public
setGroup(string $group) : void
Parameters
- $group : string
Tags
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
$thissetLoudness()
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
$thissetTreble()
Set the treble equalisation.
public
setTreble(int $treble) : $this
Parameters
- $treble : int
-
The treble level (between -10 and 10)
Return values
$thissetVolume()
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
$thissoap()
public
soap(string $service, string $action[, array<string|int, mixed> $params = [] ]) : SoapResponse
Parameters
- $service : string
- $action : string
- $params : array<string|int, mixed> = []
Return values
SoapResponseunmute()
Unmute this speaker.
public
unmute() : $this
Return values
$thisupdateGroup()
Remove any previously established group for this speaker.
public
updateGroup() : void
Tags
lookupTopology()
Ensure we've determined this speaker's topology.
private
lookupTopology() : void
setEqLevel()
Set the bass/treble equalisation level.
private
setEqLevel(string $type, int $value) : $this
Parameters
- $type : string
-
Which setting to update (bass or treble)
- $value : int
-
The value to set (between -10 and 10)