huesmith-core 0.1.0

Platform-agnostic core for Hue-compatible Zigbee lights: color math, ZCL light state machine, and scene parsing
Documentation
use huesmith_core::hue::device::HueDeviceType;

#[test]
fn dimmable_light_device_id() {
    assert_eq!(HueDeviceType::DimmableLight.device_id(), 0x0101);
}

#[test]
fn on_off_light_device_id() {
    assert_eq!(HueDeviceType::OnOffLight.device_id(), 0x0100);
}

#[test]
fn color_temperature_light_device_id() {
    assert_eq!(HueDeviceType::ColorTemperatureLight.device_id(), 0x010C);
}

#[test]
fn extended_color_light_device_id() {
    assert_eq!(HueDeviceType::ExtendedColorLight.device_id(), 0x010D);
}

#[test]
fn dimmable_light_has_level_no_color() {
    let d = HueDeviceType::DimmableLight;
    assert!(d.has_level_control());
    assert!(!d.has_color_control());
}

#[test]
fn on_off_light_has_no_level_no_color() {
    let d = HueDeviceType::OnOffLight;
    assert!(!d.has_level_control());
    assert!(!d.has_color_control());
}

#[test]
fn color_temperature_light_has_level_and_color() {
    let d = HueDeviceType::ColorTemperatureLight;
    assert!(d.has_level_control());
    assert!(d.has_color_control());
    assert!(!d.has_rgb());
}

#[test]
fn extended_color_light_has_level_color_and_rgb() {
    let d = HueDeviceType::ExtendedColorLight;
    assert!(d.has_level_control());
    assert!(d.has_color_control());
    assert!(d.has_rgb());
}