14 releases
0.6.0 | Oct 8, 2023 |
---|---|
0.5.2 | Nov 7, 2022 |
0.5.0 | Jun 19, 2022 |
0.4.5 | Jun 18, 2022 |
0.1.0 | Jun 16, 2022 |
#1041 in Hardware support
23 downloads per month
25KB
393 lines
Yeelight API This library provides a Rust API for the Yeelight device. It is based on the official Yeelight API documentation.
Examples
use apyee::device::Device;
use apyee::method::Method;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a new Device with the IP address of the device and the default port.
// creating the Device will also connect to it and start listening for responses.
let mut device = Device::new("192.168.100.5").await?;
// Send a command through a convenience method and toggle its power state.
device.toggle().await?;
// Set its RGB Color to red.
device.set_rgb(255, 0, 0).await?;
// Send any possible command to the device.
device.execute_method(Method::SetBright(50, None, None)).await?;
Ok(())
}
Dependencies
~4–11MB
~103K SLoC