#philips #hue #light #bulb

bin+lib hueclient

Rust library for Philips Hue lights

22 releases

0.4.1 Feb 2, 2021
0.3.10 Oct 17, 2020
0.3.9 Jul 20, 2020
0.3.6 Feb 9, 2020
0.2.1 Mar 26, 2015

#168 in Hardware support

Download history 12/week @ 2021-10-04 30/week @ 2021-10-11 8/week @ 2021-10-18 14/week @ 2021-10-25 24/week @ 2021-11-01 29/week @ 2021-11-08 15/week @ 2021-11-15 24/week @ 2021-11-22 47/week @ 2021-11-29 37/week @ 2021-12-06 29/week @ 2021-12-13 23/week @ 2021-12-20 25/week @ 2021-12-27 36/week @ 2022-01-03 28/week @ 2022-01-10 23/week @ 2022-01-17

117 downloads per month
Used in purple-hue

WTFPL license

34KB
775 lines

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_user("mycomputer") // Press the bridge before running this
    .unwrap();
println!("the username was {}", bridge.username); // 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

# const USERNAME: &str = "the username that was generated in the previous example";
# let bridge = hueclient::Bridge::discover_required()
#   .with_user(USERNAME);
let cmd = hueclient::CommandLight::default().off();
for light in &bridge.get_all_lights().unwrap() {
    bridge.set_light_state(light.id, &cmd).unwrap();
}

Dependencies

~4.5–8.5MB
~210K SLoC