• Stars
    star
    222
  • Rank 179,123 (Top 4 %)
  • Language
    Rust
  • Created about 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sonos smart speaker controller API and command-line tools

Sonos smart speaker controller API and CLI

Linux: Build Status

This project implements (most of) the Sonos control API in a rust crate. It also provides a simple command-line tool which can be used in scripts.

Building

You likely need a recent rust compiler. If you don't have rustup installed yet, I recommend you do so:

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Now you are ready to build/install ronor:

$ cargo install --git https://github.com/mlang/ronor

This will copy the binary to ~/.cargo/bin/ronor which should be in your PATH if you are using rustup.

Configuration

You have to register a developer account on integration.sonos.com and create your own integration point. You also need to create your own redirection endpoint on the web. A minimalistic example script is provided in static/sonos.php. Copy that file to a web space you control, and use it as the redirection URL required when you create the integration.

With your integration information ready, run ronor init and your client id, secret, and redirection url will be saved to ~/.config/ronor/.

Now you can authorize ronor to access households belonging to your Sonos user account by running ronor login.

How to use

See ronor help for a list of available commands.

Favorites and Playlists

Sonos has two mechanisms for managing content you often play. Favorites can be thought of as pointers to specific streaming service content. For instance, a radio station, podcast, or a specific artist or album on a registered streaming service. A playlist is a list of several tracks, possibly on different streaming services. There is currently no API to create these, you have to use a Sonos controller like the iOS App to create favorites and playlists.

However, you can query and play favorites and playlists:

$ ronor get-favorites
Das Soundportal Radio
Freies Radio Salzkammergut
Österreich 1
Radio FM4
Radio Helsinki
Radio Swiss Classic
radiOzora Chill channel
SRF 2 Kultur
$ ronor load-favorite --play 'Österreich 1' Schlafzimmer
$ ronor get-playlists
Acid
Psybient
PsyDub
$ ronor load-playlist --shuffle --crossfade --play PsyDub Wohnzimmer

Managing groups

Use the modify-group subcommand to manage grouping of logical players.

For example, imagine the following household of three players and no grouping.

$ ronor inventory
Bad = Bad
Wohnzimmer = Wohnzimmer
Schlafzimmer = Schlafzimmer

That means, each player is the sole member of a group with the same name.

Now lets make a group of Schlafzimmer (bedroom) and Bad (Bathroom).

$ ronor modify-group Schlafzimmer --add Bad
Schlafzimmer -> Schlafzimmer + 1
$ ronor inventory
Schlafzimmer + 1 = Schlafzimmer + Bad
Wohnzimmer = Wohnzimmer

To undo this group, we simply remove Bad from Schlafzimmer + 1 again:

$ ronor modify-group 'Schlafzimmer + 1' --remove Bad
Schlafzimmer + 1 -> Schlafzimmer
$ ronor inventory
Bad = Bad
Wohnzimmer = Wohnzimmer
Schlafzimmer = Schlafzimmer

Notice that you never have to name groups. Sonos will automatically choose a name for a newly created group based on the coordinating player and the number of other members.

Text to speech

For the text-to-speech functionality (ronor speak) you need espeak and ffmpeg installed. Simply pipe text to STDIN and it should be spoken by the desired player.

$ echo "Hallo Wohnzimmer"|ronor speak --language de Wohnzimmer

Alternatively, ronor speak can scrape predefined web resources and speak the extracted text. The following command will speak the current weather forecast for Styria in Austria:

$ ronor speak --scrape wetter.orf.at/steiermark Wohnzimmer

The following scraping sources are predefined:

ronor speak makes use of transfer.sh for temporary storage and the loadAudioClip API. If you'd like to play already prepared audio clips, use ronor load-audio-clip.

More Repositories

1

bmc

Braille Music Compiler
C++
37
star
2

chessIO

Fast haskell chess move generator library and console UCI frontend
Haskell
31
star
3

freedots

MusicXML to Braille Music transcription
Java
16
star
4

wikiwordfreq

Haskell
7
star
5

betris

A horizontal version of tetris for braille display users
Haskell
7
star
6

purescript-monad-loops

PureScript
6
star
7

openai-kiss

Simple shell scripts to access OpenAI API
Shell
6
star
8

tracktales

MPD presenter using OpenAI Chat Completions and TTS
Python
6
star
9

yatm

Yet Another Time Machine
C++
5
star
10

xsdcxx-musicxml

C++
4
star
11

tuneit

Command-line instrument tuner
C
4
star
12

img2brl

Web service for translating images to braille
C++
4
star
13

braille

Haskell
2
star
14

eurorack-metadata

Haskell
2
star
15

purescript-logic

PureScript
2
star
16

poker.el

Emacs Lisp
2
star
17

xq

Python
2
star
18

emacs-lisp

Emacs Lisp Code Repository
Emacs Lisp
2
star
19

haskore-braille

Haskell
2
star
20

pepper

Bela/Salt project for braille displays
C++
2
star
21

brick-dropdownmenu

Haskell
2
star
22

bmmlcxx

Python
2
star
23

jackdots

Rust
1
star
24

mcp

Haskell
1
star
25

guess_the_key

JavaScript
1
star
26

ass

Assistant
Python
1
star
27

gpti

A simple REPL for interacting with OpenAI's GPT models
Haskell
1
star
28

braille-parsers

Haskell
1
star
29

mediatheken

Python
1
star
30

braille-conway

Conway's Game of Braille
Haskell
1
star
31

sound-supercollider

Simple SuperCollider client library for Haskell
Haskell
1
star
32

maradio

Haskell
1
star
33

cbookview

Terminal application to explore chess openings
Haskell
1
star
34

bctag-dl

Haskell
1
star
35

Motorized.quark

SuperCollider
1
star
36

annalise

Chess TUI
Haskell
1
star
37

-lang

reflex and bison template
CMake
1
star
38

brlapi-rust

Rust
1
star
39

config.supercollider

SuperCollider Configuration
SuperCollider
1
star
40

captain-future-ost-mix

Shell
1
star
41

mario

Racket
1
star