Skip to main content

huesmith_core/light/
command.rs

1pub const DEFAULT_ON_OFF_TRANSITION_TENTHS: u16 = 4;
2pub const DEFAULT_LEVEL_TRANSITION_TENTHS: u16 = 5;
3pub const DEFAULT_COLOR_TRANSITION_TENTHS: u16 = 7;
4
5/// Commands that can be received from the Hue Bridge or other ZCL controllers.
6#[derive(Debug, Clone)]
7#[non_exhaustive]
8pub enum LightCommand {
9    On,
10    Off,
11    Toggle,
12    SetLevel {
13        level: u8,
14        transition_time: u16,
15    },
16    MoveToColor {
17        /// `None` when only the peer coordinate arrived; `Some(0)` is valid (edge of CIE gamut).
18        x: Option<u16>,
19        /// `None` when only the peer coordinate arrived; `Some(0)` is valid (edge of CIE gamut).
20        y: Option<u16>,
21        transition_time: u16,
22    },
23    MoveToColorTemp {
24        mireds: u16,
25        transition_time: u16,
26    },
27    MoveToHueAndSaturation {
28        /// `None` when only the peer attribute (saturation) was written; `Some(0)` = pure red.
29        hue: Option<u8>,
30        /// `None` when only the peer attribute (hue) was written; `Some(0)` = fully desaturated.
31        saturation: Option<u8>,
32        transition_time: u16,
33    },
34    EnhancedMoveToHueAndSaturation {
35        enhanced_hue: u16,
36        /// `None` when only enhanced hue was written; `Some(0)` = fully desaturated.
37        saturation: Option<u8>,
38        transition_time: u16,
39    },
40    Identify {
41        duration: u16,
42    },
43    /// ZCL Identify cluster TriggerEffect command (0x40).
44    /// effect_id: 0x00=Blink, 0x01=Breathe, 0x02=Okay, 0x0B=ChannelChange,
45    ///            0xFE=FinishEffect (run to completion), 0xFF=StopEffect.
46    TriggerEffect {
47        effect_id: u8,
48        variant: u8,
49    },
50    StopMoveStep,
51}