Skip to content
🔈 Sonos command line interface, control your speakers right from the console.
TypeScript JavaScript Batchfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
.vscode
bin
src
test
.editorconfig
.eslintignore
.eslintrc
.gitignore
.travis.yml
README.md
package-lock.json
package.json
tsconfig.json

README.md

@svrooij/sonos-cli

Control your sonos players right from the console. This cli is started as an experiment, so it may contain bugs. If you found some bugs, please report.

Install npm i -g @svrooij/sonos-cli and start using, see below.

Support me on Github npm travis github issues Downloads/week oclif License

This sonos cli, is just a cli wrapper around the node-sonos-ts library. I could use some support in both 😉. If you like this library please tell me on twitter, or start sponsoring me.

Usage

$ npm install -g @svrooij/sonos-cli
$ sonos COMMAND
running command...
$ sonos (-v|--version|version)
@svrooij/sonos-cli/0.0.2 darwin-x64 node-v12.13.1
$ sonos --help [COMMAND]
USAGE
  $ sonos COMMAND
...

Commands

sonos alarm:list

List your alarms

USAGE
  $ sonos alarm:list

OPTIONS
  -h, --help              show CLI help
  -x, --extended          show extra columns
  --columns=columns       only show provided columns (comma-separated)
  --csv                   output is csv format [alias: --output=csv]
  --filter=filter         filter property by partial string matching, ex: name=foo
  --no-header             hide table header from output
  --no-truncate           do not truncate output to fit screen
  --output=csv|json|yaml  output in a more machine friendly format
  --sort=sort             property to sort by (prepend '-' for descending)

See code: src/commands/alarm/list.ts

sonos alarm:update ID

Update a single alarm by ID

USAGE
  $ sonos alarm:update ID

ARGUMENTS
  ID  Alarm ID you want to update

OPTIONS
  -h, --help                        show CLI help
  --disable                         Disable the alarm?
  --duration=duration               Duration as hh:mm:ss
  --enable                          Enable the alarm?
  --recurrence=DAILY|WEEKDAYS|ONCE  What is the recurrence of this alarm
  --start=start                     Starttime as hh:mm:ss
  --volume=volume                   New Volume

See code: src/commands/alarm/update.ts

sonos control DEVICE CONTROL

describe the command here

USAGE
  $ sonos control DEVICE CONTROL

ARGUMENTS
  DEVICE   Name or uuid of player
  CONTROL  (play|pause|next|previous|toggle|stop|volumeup|volumedown) What do you want to control

OPTIONS
  -h, --help  show CLI help

See code: src/commands/control.ts

sonos execute DEVICE COMMAND [INPUT]

Execute a command on the sonos

USAGE
  $ sonos execute DEVICE COMMAND [INPUT]

ARGUMENTS
  DEVICE   Name or uuid of player
  COMMAND  command to call
  INPUT    Optional input for command

OPTIONS
  -h, --help  show CLI help

See code: src/commands/execute.ts

sonos help [COMMAND]

display help for sonos

USAGE
  $ sonos help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

sonos info DEVICE KIND

Show device data

USAGE
  $ sonos info DEVICE KIND

ARGUMENTS
  DEVICE  Name or uuid of player
  KIND    (attributes|media|position|queue|volume) What do you want to load

OPTIONS
  -h, --help  show CLI help

See code: src/commands/info.ts

sonos play DEVICE URL

Add the supplied url to the queue

USAGE
  $ sonos play DEVICE URL

ARGUMENTS
  DEVICE  Name or uuid of player
  URL     The url to play

OPTIONS
  -h, --help    show CLI help
  --skip-queue

See code: src/commands/play.ts

sonos zones [FILE]

Do device discovery

USAGE
  $ sonos zones [FILE]

OPTIONS
  -h, --help              show CLI help
  -x, --extended          show extra columns
  --columns=columns       only show provided columns (comma-separated)
  --csv                   output is csv format [alias: --output=csv]
  --filter=filter         filter property by partial string matching, ex: name=foo
  --ip=ip                 Use IP instead of discovery
  --no-header             hide table header from output
  --no-truncate           do not truncate output to fit screen
  --output=csv|json|yaml  output in a more machine friendly format
  --save
  --sort=sort             property to sort by (prepend '-' for descending)

See code: src/commands/zones.ts

Development

This library is written in TypeScript, that means you'll need to compile it before using. This is done automatically when packaging, but you can also run npm run prepack. Starting this library from the repository is done by ./bin/run [command] ....

Tests aren't implemented everywhere, if you feel like it send me a pull request.

Oclif

oclif

Oclif is a cli framework created by the guys (and girls) from heroku. When starting this library it was the want that seems to have the most featured I wanted for a cli framework. This wasn't a thourogh research, I just picked the one I liked.

You can’t perform that action at this time.