Rust bindings for the [Philips Hue API].
This library sends HTTP requests to the bridge using the [ureq] crate. The responses/requests are deserialized/serialized using the [serde], [serdejson] and [serderepr] crates.
Register a user and set the brightness and saturation of a light. ```rust use huelib::{bridge, light}; use std::net::{IpAddr, Ipv4Addr};
let bridgeip = IpAddr::V4(Ipv4Addr::new(192, 168, 1, 2)); let username = match bridge::registeruser(bridgeip, "huelib-rs example", false) { Ok(v) => v.name, Err(e) => { println!("Failed to register user: {}", e); return; } }; let bridge = huelib::Bridge::new(bridgeip, &username); let statemodifier = light::StateModifier::new() .brightness(huelib::ModifierType::Increment, 40) .saturation(huelib::ModifierType::Override, 200); match bridge.setlightstate("1", &statemodifier) { Ok(v) => { for response in v { println!("{}", response); } }, Err(e) => { println!("Failed to set the state of the light: {}", e); return; } }; ```