pub enum Message {
Show 61 variants
GetService,
StateService {
service: Service,
port: u32,
},
GetHostInfo,
StateHostInfo {
signal: f32,
tx: u32,
rx: u32,
reserved: i16,
},
GetHostFirmware,
StateHostFirmware {
build: u64,
reserved: u64,
version_minor: u16,
version_major: u16,
},
GetWifiInfo,
StateWifiInfo {
signal: f32,
reserved6: u32,
reserved7: u32,
reserved: i16,
},
GetWifiFirmware,
StateWifiFirmware {
build: u64,
reserved: u64,
version_minor: u16,
version_major: u16,
},
GetPower,
SetPower {
level: PowerLevel,
},
StatePower {
level: u16,
},
GetLabel,
SetLabel {
label: LifxString,
},
StateLabel {
label: LifxString,
},
GetVersion,
StateVersion {
vendor: u32,
product: u32,
reserved: u32,
},
GetInfo,
StateInfo {
time: u64,
uptime: u64,
downtime: u64,
},
Acknowledgement {
seq: u8,
},
GetLocation,
SetLocation {
location: LifxIdent,
label: LifxString,
updated_at: u64,
},
StateLocation {
location: LifxIdent,
label: LifxString,
updated_at: u64,
},
GetGroup,
SetGroup {
group: LifxIdent,
label: LifxString,
updated_at: u64,
},
StateGroup {
group: LifxIdent,
label: LifxString,
updated_at: u64,
},
EchoRequest {
payload: EchoPayload,
},
EchoResponse {
payload: EchoPayload,
},
LightGet,
LightSetColor {
reserved: u8,
color: HSBK,
duration: u32,
},
SetWaveform {
reserved: u8,
transient: bool,
color: HSBK,
period: u32,
cycles: f32,
skew_ratio: i16,
waveform: Waveform,
},
LightState {
color: HSBK,
reserved: i16,
power: u16,
label: LifxString,
reserved2: u64,
},
LightGetPower,
LightSetPower {
level: u16,
duration: u32,
},
LightStatePower {
level: u16,
},
SetWaveformOptional {
reserved: u8,
transient: bool,
color: HSBK,
period: u32,
cycles: f32,
skew_ratio: i16,
waveform: Waveform,
set_hue: bool,
set_saturation: bool,
set_brightness: bool,
set_kelvin: bool,
},
LightGetInfrared,
LightStateInfrared {
brightness: u16,
},
LightSetInfrared {
brightness: u16,
},
LightGetHevCycle,
LightSetHevCycle {
enable: bool,
duration: u32,
},
LightStateHevCycle {
duration: u32,
remaining: u32,
last_power: bool,
},
LightGetHevCycleConfiguration,
LightSetHevCycleConfiguration {
indication: bool,
duration: u32,
},
LightStateHevCycleConfiguration {
indication: bool,
duration: u32,
},
LightGetLastHevCycleResult,
LightStateLastHevCycleResult {
result: LastHevCycleResult,
},
SetColorZones {
start_index: u8,
end_index: u8,
color: HSBK,
duration: u32,
apply: ApplicationRequest,
},
GetColorZones {
start_index: u8,
end_index: u8,
},
StateZone {
count: u8,
index: u8,
color: HSBK,
},
StateMultiZone {
count: u8,
index: u8,
color0: HSBK,
color1: HSBK,
color2: HSBK,
color3: HSBK,
color4: HSBK,
color5: HSBK,
color6: HSBK,
color7: HSBK,
},
GetMultiZoneEffect,
SetMultiZoneEffect {
instance_id: u32,
typ: MultiZoneEffectType,
reserved: u16,
speed: u32,
duration: u64,
reserved7: u32,
reserved8: u32,
parameters: [u32; 8],
},
StateMultiZoneEffect {
instance_id: u32,
typ: MultiZoneEffectType,
reserved: u16,
speed: u32,
duration: u64,
reserved7: u32,
reserved8: u32,
parameters: [u32; 8],
},
SetExtendedColorZones {
duration: u32,
apply: ApplicationRequest,
zone_index: u16,
colors_count: u8,
colors: Box<[HSBK; 82]>,
},
GetExtendedColorZone,
StateExtendedColorZones {
zones_count: u16,
zone_index: u16,
colors_count: u8,
colors: Box<[HSBK; 82]>,
},
RelayGetPower {
relay_index: u8,
},
RelaySetPower {
relay_index: u8,
level: u16,
},
RelayStatePower {
relay_index: u8,
level: u16,
},
}
Expand description
Decoded LIFX Messages
This enum lists all of the LIFX message types known to this library.
Note that other message types exist, but are not officially documented (and so are not available here).
Variants§
GetService
Sent by a client to acquire responses from all devices on the local network. No payload is required. Causes the devices to transmit a Message::StateService message.
Message type 2
StateService
Fields
Response to Message::GetService message.
You’ll want to save the port number in this message, so you can send future messages directly to this device.
Message type 3
GetHostInfo
Get Host MCU information. No payload is required. Causes the device to transmit a Message::StateHostInfo message.
Message type 12
StateHostInfo
Fields
GetHostFirmware
Gets Host MCU firmware information
Causes the device to transmit a Message::StateHostFirmware message.
Message type 14
StateHostFirmware
Fields
GetWifiInfo
Get Wifi subsystem information. No payload is required. Causes the device to transmit a Message::StateWifiInfo message.
Message type 16
StateWifiInfo
Fields
signal: f32
Radio receive signal strength
The units of this field varies between different products. See this LIFX doc for more info: https://lan.developer.lifx.com/docs/information-messages#statewifiinfo---packet-17
StateWifiInfo - 17
Response to Message::GetWifiInfo message.
Provides Wifi subsystem information.
Message type 17
GetWifiFirmware
Get Wifi subsystem firmware
Causes the device to transmit a Message::StateWifiFirmware message.
Message type 18
StateWifiFirmware
Fields
GetPower
SetPower
Fields
level: PowerLevel
normally a u16, but only 0 and 65535 are supported.
Zero implies standby and non-zero sets a corresponding power draw level.
Set device power level.
Message type 21
StatePower
Fields
GetLabel
SetLabel
Fields
label: LifxString
Set the device label text.
Message type 24
StateLabel
Fields
label: LifxString
GetVersion
Get the hardware version
Causes the device to transmit a Message::StateVersion message.
Message type 32
StateVersion
Fields
Response to Message::GetVersion message.
Provides the hardware version of the device. To get more information about this product, use the get_product_info function.
Message type 33
GetInfo
Get run-time information
Causes the device to transmit a Message::StateInfo message.
Message type 34
StateInfo
Fields
Acknowledgement
Response to any message sent with ack_required set to 1. See message header frame address.
(Note that technically this message has no payload, but the frame sequence number is stored here for convenience).
Message type 45
GetLocation
Ask the bulb to return its location information
Causes the device to transmit a Message::StateLocation message.
Message type 48
SetLocation
Fields
label: LifxString
The name assigned to this location
Set the device location
Message type 49
StateLocation
Device location.
Message type 50
GetGroup
Ask the bulb to return its group membership information
Causes the device to transmit a Message::StateGroup message.
Message type 51
SetGroup
Set the device group
Message type 52
StateGroup
Fields
label: LifxString
The name assigned to this group
Device group.
Message type 53
EchoRequest
Fields
payload: EchoPayload
Request an arbitrary payload be echoed back
Causes the device to transmit an Message::EchoResponse message.
Message type 58
EchoResponse
Fields
payload: EchoPayload
Response to Message::EchoRequest message.
Echo response with payload sent in the EchoRequest.
Message type 59
LightGet
Sent by a client to obtain the light state.
Causes the device to transmit a Message::LightState message.
Note: this message is also known as GetColor
in the LIFX docs. Message type 101
LightSetColor
Sent by a client to change the light state.
If the Frame Address res_required field is set to one (1) then the device will transmit a State message.
Message type 102
SetWaveform
Fields
Apply an effect to the bulb.
Message type 103
LightState
Fields
label: LifxString
The current label on the device
Sent by a device to provide the current light state.
This message is sent in reply to Message::LightGet, Message::LightSetColor, Message::SetWaveform, and Message::SetWaveformOptional
Message type 107
LightGetPower
Sent by a client to obtain the power level
Causes the device to transmit a Message::LightStatePower message.
Message type 116
LightSetPower
Sent by a client to change the light power level.
The duration is the power level transition time in milliseconds.
If the Frame Address res_required field is set to one (1) then the device will transmit a StatePower message.
Message type 117
LightStatePower
Sent by a device to provide the current power level.
Message type 118
SetWaveformOptional
Fields
Apply an effect to the bulb.
Message type 119
LightGetInfrared
Gets the current maximum power level of the Infrared channel
Message type 120
LightStateInfrared
Indicates the current maximum setting for the infrared channel.
Message type 121
LightSetInfrared
Set the current maximum brightness for the infrared channel.
Message type 122
LightGetHevCycle
Get the state of the HEV LEDs on the device
Causes the device to transmite a [Messages::LightStateHevCycle] message.
This message requires the device has the hev
capability
Message type 142
LightSetHevCycle
Fields
Message type 143
LightStateHevCycle
Fields
Whether a HEV cycle is running on the device
Message type 144
LightGetHevCycleConfiguration
Getthe default configuration for using the HEV LEDs on the device
This message requires the device has the hev
capability
Message type 145
LightSetHevCycleConfiguration
Message type 146
LightStateHevCycleConfiguration
Message type 147
LightGetLastHevCycleResult
Message type 148
LightStateLastHevCycleResult
Fields
result: LastHevCycleResult
Message type 149
SetColorZones
This message is used for changing the color of either a single or multiple zones. The changes are stored in a buffer and are only applied once a message with either ApplicationRequest::Apply or ApplicationRequest::ApplyOnly set.
Message type 501
GetColorZones
GetColorZones is used to request the zone colors for a range of zones.
The bulb will respond with either Message::StateZone or Message::StateMultiZone messages as required to cover the requested range. The bulb may send state messages that cover more than the requested zones. Any zones outside the requested indexes will still contain valid values at the time the message was sent.
Message type 502
StateZone
The StateZone message represents the state of a single zone with the index
field indicating
which zone is represented. The count
field contains the count of the total number of zones
available on the device.
Message type 503
StateMultiZone
Fields
The StateMultiZone message represents the state of eight consecutive zones in a single message.
As in the StateZone message the count
field represents the count of the total number of
zones available on the device. In this message the index
field represents the index of
color0
and the rest of the colors are the consecutive zones thus the index of the
color_n
zone will be index + n
.
Message type 506
GetMultiZoneEffect
Message type 507
SetMultiZoneEffect
Fields
typ: MultiZoneEffectType
Message type 508
StateMultiZoneEffect
Fields
typ: MultiZoneEffectType
Message type 509
SetExtendedColorZones
Fields
apply: ApplicationRequest
Message type 510
GetExtendedColorZone
Message type 511
StateExtendedColorZones
Message type 512
RelayGetPower
Get the power state of a relay
This requires the device has the relays
capability.
Message type 816
RelaySetPower
Fields
Message ty 817
RelayStatePower
Fields
The state of the device relay
Message type 818
Implementations§
source§impl Message
impl Message
sourcepub fn get_num(&self) -> u16
pub fn get_num(&self) -> u16
Get the message type
This will be used in the typ
field of the ProtocolHeader.
sourcepub fn from_raw(msg: &RawMessage) -> Result<Message, Error>
pub fn from_raw(msg: &RawMessage) -> Result<Message, Error>
Tries to parse the payload in a RawMessage, based on its message type.