https://github.com/jakobhellermann/sonor
Sonos library for rust
https://github.com/jakobhellermann/sonor
Last synced: about 1 year ago
JSON representation
Sonos library for rust
- Host: GitHub
- URL: https://github.com/jakobhellermann/sonor
- Owner: jakobhellermann
- Created: 2019-04-16T10:13:48.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2023-09-16T14:09:04.000Z (almost 3 years ago)
- Last Synced: 2025-04-12T23:53:45.002Z (about 1 year ago)
- Language: Rust
- Homepage:
- Size: 161 KB
- Stars: 33
- Watchers: 1
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

[](https://crates.io/crates/sonor)
This crate is a Sonos controller library written in Rust.
It operates asynchronously and aims for a simple to use yet powerful API.
# Example
```rust
let speaker = sonor::find("your room name", Duration::from_secs(2)).await?
.expect("room exists");
println!("The volume is currently at {}", speaker.volume().await?);
match speaker.track().await? {
Some(track_info) => println!("- Currently playing '{}", track_info.track()),
None => println!("- No track currently playing"),
}
speaker.clear_queue().await?;
speaker.join("some other room").await?;
```
For a full list of actions implemented, look at the [Speaker](struct.Speaker.html) docs.
If your use case isn't covered, this crate also exposes the raw UPnP Action API
[here](struct.Speaker.html#method.action).
It can be used like this:
```rust
use sonor::URN;
let service = URN::service("schemas-upnp-org", "GroupRenderingControl", 1);
let args = "0";
let response = speaker.action(&service, "GetGroupMute", args).await?;
println!("{}", response["CurrentMute"]);
```