Coder Social home page Coder Social logo

sonos-cli's Introduction

Sonos command-line interface

Control your Sonos players from command-line. Uses Sonos Control API to control Sonos groups.

Build Status

Installation

Using Homebrew on OSX:

brew tap bwilczynski/tap
brew install sonos-cli

Using pip (requires Python 3):

pip install sonos-cli

Usage

$ sonos [OPTIONS] COMMAND [ARGS]

Get Started

Setup integration with Sonos API and run sonos config to provide your application's Client ID and Client Secret.

Make sure that:

  • Redirect URI is set to: http://localhost:5000
  • YOUR_CLIENT_ID: set to your Key (and not key name)
  • YOUR_CLIENT_SECRET: set to your Secret

Sonos Integration

Alternatively set the following environment variables before running sonos:

export SONOS_CLIENT_ID={YOUR_CLIENT_ID}
export SONOS_CLIENT_SECRET={YOUR_CLIENT_SECRET}

Login to your Sonos service (opens a web browser sending user to Sonos login service):

$ sonos login

Set active household:

$ sonos set household

For usage and help content, pass in the --help parameter, for example:

$ sonos --help
$ sonos get --help

Available commands

Get information from your Sonos:

$ sonos get [groups | households | playlists | tracks]

Format displayed result using --output option:

$ sonos get groups --output table

coordinatorId             id                                   name              playbackState
------------------------  -----------------------------------  ----------------  ----------------------
RINCON_B8E937E6D36202100  RINCON_B8E937E6D36202100:23          Bedroom.          PLAYBACK_STATE_PAUSED
RINCON_B8E937E6D40E02100  RINCON_B8E937E6D40E02100:128         Bathroom          PLAYBACK_STATE_IDLE
RINCON_B8E937DA7E6802100  RINCON_B8E937DA7E6802100:17          Bathroom 2.       PLAYBACK_STATE_PAUSED
RINCON_347E5C90FA9502100  RINCON_347E5C90FA9502100:4142323492  Living Room       PLAYBACK_STATE_PLAYING
$ sonos get groups --output json

[
  {
    "coordinatorId": "RINCON_B8E937E6D36202100",
    "id": "RINCON_B8E937E6D36202100:23",
    "name": "Bedroom",
    "playbackState": "PLAYBACK_STATE_PAUSED",
    ...
  }
  ...
}

Control playback:

$ sonos play
$ sonos pause
$ sonos next
$ sonos prev

Set active group / household:

$ sonos set [group | household]

Get playback status:

$ sonos status

Control group volume

$ sonos volume
20
$ sonos volume 25

The volume can also be set relative to its current value by prefixing it with + or -. To avoid the parameter being treated as a flag when setting a negative value, using -- before.

$ sonos volume +5
$ sonos volume -- -5

sonos-cli's People

Contributors

bwilczynski avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.