| Crates.io | wiim_api |
| lib.rs | wiim_api |
| version | 0.1.0 |
| created_at | 2025-07-18 21:11:29.133314+00 |
| updated_at | 2025-07-18 21:11:29.133314+00 |
| description | A Rust library and CLI tool for controlling WiiM audio streaming devices via their HTTP API |
| homepage | https://github.com/carloseberhardt/wiim_api |
| repository | https://github.com/carloseberhardt/wiim_api |
| max_upload_size | |
| id | 1759689 |
| size | 156,016 |
A Rust library for controlling WiiM audio streaming devices via their HTTP API.
tokio and proper error handlingAdd this to your Cargo.toml:
[dependencies]
wiim_api = "0.1"
tokio = { version = "1.0", features = ["full"] }
use wiim_api::{WiimClient, Result};
#[tokio::main]
async fn main() -> Result<()> {
let client = WiimClient::connect("192.168.1.100").await?;
let now_playing = client.get_now_playing().await?;
println!("{} - {}",
now_playing.artist.unwrap_or_default(),
now_playing.title.unwrap_or_default()
);
client.set_volume(75).await?;
client.pause().await?;
Ok(())
}
let client = WiimClient::new("192.168.1.100");
let client = WiimClient::connect("192.168.1.100").await?;
client.play().await?;
client.pause().await?;
client.stop().await?;
client.toggle_play_pause().await?;
client.next_track().await?;
client.previous_track().await?;
client.set_volume(75).await?;
client.volume_up(Some(5)).await?;
client.volume_down(Some(3)).await?;
client.mute().await?;
client.unmute().await?;
let info = client.get_now_playing().await?;
let status = client.get_player_status().await?;
let metadata = client.get_meta_info().await?;
Find your WiiM device's IP address via:
192.168.1.1 or 192.168.0.1nmap -sn 192.168.1.0/24Current implementation: 52% of WiiM HTTP API
This library focuses on playback monitoring and control. Key implemented features:
Key limitations:
See API_COVERAGE.md for detailed gap analysis and roadmap.
This library works with all WiiM devices that support the HTTP API:
The examples/ directory contains basic_usage.rs - Simple getting started example.
Run examples with: cargo run --example basic_usage
This library includes a command-line tool for integration with status bars and automation. For detailed CLI usage, template system, and status bar integration guides, see CLI.md.
The library uses a custom Result<T> type with WiimError:
match client.get_now_playing().await {
Ok(info) => println!("Playing: {:?}", info.title),
Err(wiim_api::WiimError::Request(_)) => println!("Network error"),
Err(wiim_api::WiimError::Json(_)) => println!("Invalid response"),
Err(e) => println!("Other error: {}", e),
}
Contributions are welcome! Please feel free to submit a Pull Request.
Clone the repository:
git clone https://github.com/carloseberhardt/wiim_api.git
cd wiim_api
Install pre-commit hooks:
pip install pre-commit
pre-commit install
Run tests: cargo test, cargo fmt --check, cargo clippy
Licensed under either of
at your option.
This is an unofficial library. WiiM is a trademark of Linkplay. This project is not affiliated with or endorsed by Linkplay or WiiM.