2 releases

0.1.1 Dec 24, 2018
0.1.0 Dec 23, 2018

#3 in #bulb


Used in 2 crates (via adm)

Apache-2.0/MIT

125KB
2K SLoC

lifxi

Build Status Crates.io Documentation

Control LIFX devices over (eventually LAN and) the internet.

Getting Started

This crate currently only supports control via the web API. To get started, go to the LIFX account settings page and create an access token.

The Client struct is the entry point for all functionality in this crate. It's advised to have a single instance of this client, as it holds a connection pool. Depending on your architecture, the lazy-static crate may be a good choice:

lazy_static! {
    static ref CLIENT: Client = Client::new("secret");
}

Here's a simple demo to ensure everything's working:

use lifxi::http::*;
fn main() {
    let client = Client::new("your secret here");
    let _result = client
        .select(Selector::All)
        .set_state()
        .power(true)
        .color(Color::Red)
        .brightness(0.4)
        .send();
}

If running that example results in all of your LIFX bulbs turning on and changing to red, you're in business! Head over to the docs to see more.

Contributing

Contributions are welcome! Submit a pull request, file an issue, or feel free to just discuss in the comments. The LIFX HTTP API documentation and LAN protocol documentation will likely be helpful in any development efforts.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.

License

Licensed under the Apache License, Version 2.0 or the MIT License, at your option.

Dependencies

~15MB
~348K SLoC