@svrooij/sonos-cli
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

@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.

Sonos cli npm Sonos api documentation Sonos typescript this library Sonos2mqtt Join us on Discord

github issues Downloads/week oclif License Support me on Github All Contributors

This sonos cli, is just a cli wrapper around the 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.2.2 linux-x64 node-v12.22.7
$ sonos --help [COMMAND]
USAGE
  $ sonos COMMAND
...

Commands

sonos alarm:delete ID

Delete an alarm by ID

USAGE
  $ sonos alarm:delete ID

ARGUMENTS
  ID  The ID of the alarm you want to delete

OPTIONS
  -h, --help  Show CLI help.

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

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 COMMAND

Send a simple command to your speaker

USAGE
  $ sonos control DEVICE COMMAND

ARGUMENTS
  DEVICE   Name or uuid of player

  COMMAND  (play|pause|next|previous|toggle|stop|volumeup|volumedown|mute|unmute|togglemute|repeatall|repeatone|repeatof
           f|togglerepeat|shuffleon|shuffleoff|toggleshuffle) What command do you want to send

OPTIONS
  -h, --help       Show CLI help.
  --ip=ip          Load devices from IP instead of Service Discovery
  --refresh-zones  Refresh the discovered zones
  --save-zones     Save the discovered zones

See code: src/commands/control.ts

sonos execute DEVICE COMMAND [INPUT]

Execute all available commands on the sonos library. See https://svrooij.github.io/node-sonos-ts/sonos-device for available commands

USAGE
  $ sonos execute DEVICE COMMAND [INPUT]

ARGUMENTS
  DEVICE   Name or uuid of player
  COMMAND  command to call, eg. AVTransportService.Next
  INPUT    Optional input for command

OPTIONS
  -h, --help  Show CLI help.

EXAMPLES
  sonos execute {device} AVTransportService.Next
  sonos execute {device} SwitchToLineIn
  sonos execute {device} SwitchToQueue
  sonos execute {device} SwitchToTV
  sonos execute Bedroom AVTransportService.ConfigureSleepTimer '{"InstanceID": 0, "NewSleepTimerDuration": "00:04:00"}'

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 info

USAGE
  $ sonos info DEVICE KIND

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

OPTIONS
  -h, --help       Show CLI help.
  --ip=ip          Load devices from IP instead of Service Discovery
  --refresh-zones  Refresh the discovered zones
  --save-zones     Save the discovered zones

See code: src/commands/info.ts

sonos music:browse

Browse music in an external music service

USAGE
  $ sonos music:browse

OPTIONS
  -h, --help         Show CLI help.
  --count=count      [default: 10]
  --root=root        [default: root] Start browsing at this tag.
  --service=service  Music Service ID

See code: src/commands/music/browse.ts

sonos music:login

Login to your favorite music service

USAGE
  $ sonos music:login

OPTIONS
  -h, --help         Show CLI help.
  --service=service  Music Service ID

See code: src/commands/music/login.ts

sonos music:services

Show all music services!

USAGE
  $ sonos music:services

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)
  --subscribed            Only show services where you logged-in to

See code: src/commands/music/services.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.
  --ip=ip          Load devices from IP instead of Service Discovery
  --refresh-zones  Refresh the discovered zones
  --save-zones     Save the discovered zones
  --skip-queue

See code: src/commands/play.ts

sonos queue DEVICE COMMAND

Manipulates the queue on your speaker

USAGE
  $ sonos queue DEVICE COMMAND

ARGUMENTS
  DEVICE   Name or uuid of player
  COMMAND  (clear|next|previous) What command do you want to send

OPTIONS
  -h, --help       Show CLI help.
  --ip=ip          Load devices from IP instead of Service Discovery
  --refresh-zones  Refresh the discovered zones
  --save-zones     Save the discovered zones

See code: src/commands/queue.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.

Contributors

Thanks goes to these wonderful people (emoji key):


Stephan van Rooij

💻 📖

Matthew Douglass

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Commit style

This repository will automatically create a new release if your commit message follow the conventional commits specification.

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Bugfix sample: fix: Play command did not work

Feature sample: feat: Added command x and y

This repository will auto release a new version if commits starting with either fix: or feat: are detected. Make sure this is in your commit to provide a fast release of your fix.

PR branch

Always create your pull request against the beta branch. I will release this branch to the main branch at a regular interval or when we build some awesome new feature.

Versions

Current Tags

Version History

Package Sidebar

Install

npm i @svrooij/sonos-cli

Weekly Downloads

3

Version

0.2.2

License

MIT

Unpacked Size

86.5 kB

Total Files

53

Last publish

Collaborators

  • svrooij