magichue-rs

Crates.iomagichue-rs
lib.rsmagichue-rs
version0.1.0
created_at2025-06-27 01:55:20.806158+00
updated_at2025-06-27 01:55:20.806158+00
descriptionControl MagicHue brand Wi-Fi LED bulbs using Rust
homepage
repository
max_upload_size
id1728060
size4,246
(qaiik)

documentation

README

magichue-rs

Control MagicHome/MagicHue Wi-Fi LED smart bulbs in pure Rust.

Features

  • Connect to MagicHue/MagicHome bulbs over TCP
  • Turn the bulb on/off
  • Set RGB color with brightness scaling
  • Set warm white or cool white brightness levels

Which bulbs?

This crate supports MagicLight Wi-Fi LED Bulbs, which use the MagicHome protocol without checksum verification.

I suggest purchasing that light if you intend to use this library, as I have not tested any others yet, and they are very difficult to find anyways.

Example

use magichue_rs::MagicBulb;

fn main() -> std::io::Result<()> {
    let mut bulb = MagicBulb::new("192.168.1.42");
    bulb.connect()?;

    bulb.turn_on()?;
    bulb.set_rgb(255, 0, 128, 200)?; // Pink-ish with 200/255 brightness
    bulb.set_ww(128)?; // Set warm white to 50% brightness
    bulb.turn_off()?;

    Ok(())
}
Commit count: 0

cargo fmt