Crate rusty_sonos

source ·
Expand description

§rusty-sonos

A Rust library that allows you to discover and interact with Sonos speakers

Connecting to a Sonos speaker:

let ip_addr = Ipv4Addr::from_str("192.168.1.0").unwrap();

let speaker = Speaker::new(ip_addr).await.unwrap();

Discovering speakers on the current network:

// search for 2 seconds, with a read timeout of 5 seconds
let devices = discover_devices(Duration::from_secs(2), Duration::from_secs(5)).await.unwrap();

for device in devices {
   println!("{}, {}", device.friendly_name(), device.room_name())
}

Get information about a speaker at a certain IP address

let ip_addr = Ipv4Addr::from_str("192.168.1.0").unwrap();

let info = get_speaker_info(ip_addr).await.unwrap();

Modules§

  • Resources for learning about speakers on the current network
  • Crate error types
  • Structs and enums used while parsing speaker data
  • Resources for connecting to and controlling speakers