cute_lights

Crates.iocute_lights
lib.rscute_lights
version
sourcesrc
created_at2024-07-14 18:05:18.492464
updated_at2024-07-15 22:15:01.191925
descriptionA Rust library for controlling Smart Lights
homepagehttps://github.com/bedsteler20/cute-lights-sdk
repositoryhttps://github.com/bedsteler20/cute-lights-sdk
max_upload_size
id1303166
size0
Cameron Dehning (bedsteler20)

documentation

README

Cute Lights

Cute Lights is a simple library for controlling various types of smart lights threw a unified api. It is designed to be simple to use and easy to extend. It can be used as a rust crate or a c shared library. With bindings for dotnet and python.

Supported Lights

  • Philips Hue
  • Tp-Link Kasa
  • Govee (Must have lan control enabled)
  • OpenRgb

Usage

use cute_lights::{discover_lights, CuteResult};
use std::thread::sleep;
use std::time::Duration;

#[tokio::main]
async fn main() -> CuteResult<()> {
    let mut lights = discover_lights().await;

    loop {
       for light in lights.iter_mut() {
            light.set_on(true).await?;
            light.set_color(255, 0, 0).await?;
            light.set_brightness(100).await?;
            sleep(Duration::from_secs(1));
        }
    }
}

Configuration

The configuration file is located at ~/.config/cute_lights/lights.toml. It is used to store the ip addresses and api keys for lights. The file should look like this:

[kasa]
enabled = true
addresses = [
    "192.168.86.xx",
    "192.168.86.xx",
]

[govee]
enabled = true
addresses = ["192.168.86.xx"]

[hue]
enabled = true
bridge_ip = "192.168.86.xx"
username = "<Your Hue Api Key>"

Language Bindings

  • Rust
Commit count: 0

cargo fmt