25 releases

0.5.0 Feb 28, 2025
0.4.3 Apr 5, 2023
0.4.2 Jun 16, 2022
0.4.1 Feb 2, 2021
0.2.1 Mar 26, 2015

#153 in Hardware support

Download history 28/week @ 2024-12-04 79/week @ 2024-12-11 2/week @ 2024-12-18 15/week @ 2025-01-15 2/week @ 2025-01-22 35/week @ 2025-02-05 42/week @ 2025-02-12 472/week @ 2025-02-26 1011/week @ 2025-03-05 339/week @ 2025-03-12 7/week @ 2025-03-19

1,829 downloads per month
Used in purple-hue

WTFPL license

51KB
1K SLoC

Rust library for Philips Hue

Build Status

Features

  • discover bridge by querying philips hue website or using UPnP
  • list lights with their state
  • simple actions on lights (on, off, bri/hue/sat, transition time)
  • simple CLI utils for docs and tests :)

lib.rs:

This library aims to enable communicating with Philips Hue lights via the correspnding Bridge.

Examples

A short overview of the most common use cases of this library.

Initial Setup

let bridge = hueclient::Bridge::discover_required()
    .register_application("mycomputer") // Press the bridge before running this
    .await
    .unwrap();
println!("the username was {}", bridge.application_key); // handy for later

Second run

const USERNAME: &str = "the username that was generated in the previous example";
let bridge = hueclient::Bridge::discover_required()
   .with_user(USERNAME);

Good night

let cmd = hueclient::CommandLight::default().off();
for light in &bridge.get_all_lights().await.unwrap() {
    bridge.set_light_state(&light.id, &cmd).await.unwrap();
}

Dependencies

~15–29MB
~457K SLoC