WiiM API - Rust Library
A Rust library for controlling WiiM audio streaming devices via their HTTP API.
Features
- Now Playing Info - Get current track metadata including title, artist, album, and cover art
- Playback Control - Play, pause, stop, next/previous track
- Volume Control - Set volume (0-100), mute/unmute
- Connection Management - Test connectivity and configure target IP
- Async & Safe - Built with
tokioand proper error handling
Installation
Add this to your Cargo.toml:
[]
= "0.1"
= { = "1.0", = ["full"] }
Usage
use ;
async
API Reference
Client Creation
let client = new;
let client = connect.await?;
Playback Control
client.play.await?;
client.pause.await?;
client.stop.await?;
client.toggle_play_pause.await?;
client.next_track.await?;
client.previous_track.await?;
Volume Control
client.set_volume.await?;
client.volume_up.await?;
client.volume_down.await?;
client.mute.await?;
client.unmute.await?;
Information
let info = client.get_now_playing.await?;
let status = client.get_player_status.await?;
let metadata = client.get_meta_info.await?;
Device IP Discovery
Find your WiiM device's IP address via:
- WiiM Home app - Settings → Device Info
- Router admin page - Usually
192.168.1.1or192.168.0.1 - Network scanner - Apps like "Fing" or
nmap -sn 192.168.1.0/24
API Coverage
Current implementation: 52% of WiiM HTTP API
This library focuses on playback monitoring and control. Key implemented features:
- Now playing information and track metadata
- Playback control (play/pause/stop/next/prev)
- Volume control and muting
- Connection testing and IP configuration
Key limitations:
- Cannot start playback from URLs or playlists
- No preset access (quick stations/playlists)
- No input source switching (Bluetooth/optical/aux)
- No equalizer or device configuration
See API_COVERAGE.md for detailed gap analysis and roadmap.
Supported Devices
This library works with all WiiM devices that support the HTTP API:
- WiiM Mini
- WiiM Pro
- WiiM Pro Plus
- WiiM Amp
Examples
The examples/ directory contains basic_usage.rs - Simple getting started example.
Run examples with: cargo run --example basic_usage
CLI Tool
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.
Error Handling
The library uses a custom Result<T> type with WiimError:
match client.get_now_playing.await
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Clone the repository:
Install pre-commit hooks:
Run tests: cargo test, cargo fmt --check, cargo clippy
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Disclaimer
This is an unofficial library. WiiM is a trademark of Linkplay. This project is not affiliated with or endorsed by Linkplay or WiiM.