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

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

    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.1.2 linux-x64 node-v16.10.0
    $ 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) 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|position|queue|volume) 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 update [CHANNEL]

    update the sonos CLI

    USAGE
      $ sonos update [CHANNEL]
    

    See code: @oclif/plugin-update

    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.

    Install

    npm i @svrooij/sonos-cli

    DownloadsWeekly Downloads

    4

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    77.6 kB

    Total Files

    47

    Last publish

    Collaborators

    • svrooij