purple-hue 0.2.2

Change a hue light's color based on air quality data from purple air.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use hueclient::bridge::Bridge;
use hueclient::HueError;

pub fn register_user(bridge: &mut Bridge) -> Result<String, HueError> {
    loop {
        let r = bridge.register_user("purple-hue");
        match r {
            Err(HueError::BridgeError{ code, .. }) if code == 101 => {
                println!("Push the bridge button");
                std::thread::sleep(::std::time::Duration::from_secs(5));
                continue;
            }
            _ => return r,
        }
    }
}