\duncan3dc\SonosNetwork

Provides methods to locate speakers/controllers/playlists on the current network.

Summary

Methods
Properties
Constants
__construct()
setLogger()
getLogger()
getSpeakers()
getController()
getSpeakerByRoom()
getSpeakersByRoom()
getControllers()
getControllerByRoom()
getControllerByIp()
getPlaylists()
hasPlaylist()
getPlaylistByName()
getPlaylistById()
createPlaylist()
getAlarms()
getAlarmById()
getRadio()
No public properties found
No constants found
No protected methods found
$speakers
$playlists
$alarms
N/A
No private methods found
$collection
N/A

Properties

$speakers

$speakers : array<mixed,\duncan3dc\Sonos\Speaker>|null

Type

array<mixed,\duncan3dc\Sonos\Speaker>|null — Speakers that are available on the current network.

Methods

setLogger()

setLogger(\Psr\Log\LoggerInterface  $logger) : $this

Set the logger object to use.

Parameters

\Psr\Log\LoggerInterface $logger

Returns

$this

getLogger()

getLogger() : \Psr\Log\LoggerInterface

Get the logger object to use.

Returns

\Psr\Log\LoggerInterface —

$logger The logging object

getController()

getController() : \duncan3dc\Sonos\Interfaces\ControllerInterface

Get a Controller instance from the network.

Useful for managing playlists/alarms, as these need a controller but it doesn't matter which one.

Returns

\duncan3dc\Sonos\Interfaces\ControllerInterface

getSpeakerByRoom()

getSpeakerByRoom(string  $room) : \duncan3dc\Sonos\Interfaces\SpeakerInterface

Get a speaker with the specified room name.

Parameters

string $room

The name of the room to look for

Returns

\duncan3dc\Sonos\Interfaces\SpeakerInterface

getSpeakersByRoom()

getSpeakersByRoom(string  $room) : array<mixed,\duncan3dc\Sonos\Interfaces\SpeakerInterface>

Get all the speakers with the specified room name.

Parameters

string $room

The name of the room to look for

Returns

array<mixed,\duncan3dc\Sonos\Interfaces\SpeakerInterface>

getControllerByRoom()

getControllerByRoom(string  $room) : \duncan3dc\Sonos\Interfaces\ControllerInterface

Get the coordinator for the specified room name.

Parameters

string $room

The name of the room to look for

Returns

\duncan3dc\Sonos\Interfaces\ControllerInterface

getControllerByIp()

getControllerByIp(string  $ip) : \duncan3dc\Sonos\Interfaces\ControllerInterface

Get the coordinator for the specified ip address.

Parameters

string $ip

The ip address of the speaker

Returns

\duncan3dc\Sonos\Interfaces\ControllerInterface

hasPlaylist()

hasPlaylist(string  $name) : boolean

Check if a playlist with the specified name exists on this network.

If no case-sensitive match is found it will return a case-insensitive match.

Parameters

string $name

The name of the playlist

Returns

boolean

getPlaylistByName()

getPlaylistByName(string  $name) : \duncan3dc\Sonos\Interfaces\PlaylistInterface

Get the playlist with the specified name.

If no case-sensitive match is found it will return a case-insensitive match.

Parameters

string $name

The name of the playlist

Returns

\duncan3dc\Sonos\Interfaces\PlaylistInterface

getPlaylistById()

getPlaylistById(string  $id) : \duncan3dc\Sonos\Interfaces\PlaylistInterface

Get the playlist with the specified id.

Parameters

string $id

The ID of the playlist (eg SQ:123)

Returns

\duncan3dc\Sonos\Interfaces\PlaylistInterface

createPlaylist()

createPlaylist(string  $name) : \duncan3dc\Sonos\Interfaces\PlaylistInterface

Create a new playlist.

Parameters

string $name

The name to give to the playlist

Returns

\duncan3dc\Sonos\Interfaces\PlaylistInterface

getAlarmById()

getAlarmById(integer  $id) : \duncan3dc\Sonos\Interfaces\AlarmInterface

Get the alarm from the specified id.

Parameters

integer $id

The ID of the alarm

Returns

\duncan3dc\Sonos\Interfaces\AlarmInterface