Crate luxafor

Library, and CLI, for Luxafor lights via either USB or webhooks.

Rust Minimum Rust Version crates.io docs.rs MIT License GitHub stars

The main entry point for clients is the trait Device that has implementations for USB connected devices such as the flag as well as webhooks for both the flag and bluetooth lights.

Each connection has its own discovery or connection methods but will provide a Device implementation for the manipulation of the light state.

API Examples

The following example shows a function that sets the light to a solid red color. It demonstrates the use of a USB connected device.

```rust use luxafor::usb_hid::USBDeviceDiscovery; use luxafor::{Device, SolidColor}; use luxafor::error::Result;

fn setdonotdisturb() -> Result<()> { let discovery = USBDeviceDiscovery::new()?; let device = discovery.device()?; println!("USB device: '{}'", device.id()); device.setsolid_color(SolidColor::Red, false) } ```

The following shows the same function but using the webhook connection.

```rust use luxafor::webhook::newdevicefor; use luxafor::{Device, SolidColor}; use luxafor::error::Result;

fn setdonotdisturb(deviceid: &str) -> Result<()> { let device = newdevicefor(deviceid)?; println!("Webhook device: '{}'", device.id()); device.setsolid_color(SolidColor::Red, false) } ```

CLI Examples

The following shows the command line tool setting the color to red.

bash ❯ lux -d 2a0f2c73b72 solid red

The following shows the command line tool setting the color to a blinking green. This example uses the environment variable LUX_DEVICE to save repeating the device identifier on each call.

bash ❯ export LUX_DEVICE=2a0f2c73b72 ❯ lux blink green

The following shows the command line tool turning the light off.

bash ❯ lux -vvv -d 2a0f2c73b72 off INFO luxafor > Setting the color of device '2a0f2c73b72e' to 000000 INFO luxafor > call successful

Features

Changes

Version 0.2.2

Version 0.2.1

Version 0.2.0

Version 0.1.0

TODO