Sending commands to sonos speaker
You can control all your speakers by sending a message to sonos/uuid_of_speaker/control
with the following payload:
{
"command": "name_of_command",
"input": "optional input for this command"
}
like (to set the volume to 10):
{
"command": "volume",
"input": 10
}
Supported commands
All these commands are crafted specially to be used in sonos2mqtt.
Command | Description | Input | |
---|---|---|---|
groupvolume | ![]() | Set the group volume to a value | number (between 1 and 100) |
groupvolumedown | ![]() | Decrease group volume by 2 or input number | optional number |
groupvolumeup | ![]() | Increase group volume by 2 or input number | optional number |
joingroup | Join another group by name | name of other device | |
leavegroup | Remove current device from the group it’s in | ||
mute | ![]() | Mute the volume | |
next | ![]() | Go to next song in queue | |
notify | ![]() | Play a notification sound and restore playback | see notifications |
pause | Pause playback | ||
play | ![]() | Start playback | |
playmode | ![]() | Change the playmode, when using queue |
NORMAL , REPEAT_ALL , SHUFFLE or SHUFFLE_NOREPEAT . |
previous | ![]() | Go to previous song in queue | |
queue | ![]() | Add a song to the queue | Track uri |
repeat | Switch repeat | boolean true , false
| |
seek | ![]() | Seek in the current track | Time like 0:02:45
|
selecttrack | Select another track in the current queue | number | |
setbass | Set bass level | number between -10 and 10 | |
setbuttonlockstate | ![]() | Enable or disable buttons on device |
On , Off
|
setledstate | ![]() | Enable or disable device LED |
On , Off
|
setnightmode | ![]() | Enable or disable nightmode |
On , Off
|
setavtransporturi | ![]() | Set the current playback uri, for advanced cases. | playback or track uri (check out the trackUri topic to find the required value) |
settreble | Set treble level | number between -10 and 10 | |
shuffle | Switch shuffle | boolean true , false
| |
sleep | ![]() | Set a sleep timer for x minutes | number or hh:mm:ss
|
snooze | ![]() | Snooze running alarm for x minutes | number or hh:mm:ss
|
speak | ![]() | Generate text-to-speech file and play as notification ![]() | see text-to-speech |
stop | ![]() | Stop Playback | |
switchtoline | Switch to line-in (on supported devices) | ||
switchtoqueue | Switch to queue | ||
switchtotv | Switch to TV input (on supported devices, eg. playbar) | ||
toggle | Toggle between pause and play | ||
unmute | ![]() | Unmute the volume | |
volume | ![]() | Set the volume to a value | number (between 1 and 100) |
volumedown | ![]() | Decrease volume by 2 or input number | optional number |
volumeup | ![]() | Increase volume by 2 or input number | optional number |
Check out the commands or the mapping if you’re interested in how this works.