Crate lifx_core

Source
Expand description

This crate provides low-level message types and structures for dealing with the LIFX LAN protocol.

This lets you control lights on your local area network. More info can be found here: https://lan.developer.lifx.com/

Since this is a low-level library, it does not deal with issues like talking to the network, caching light state, or waiting for replies. This should be done at a higher-level library.

§Discovery

To discover lights on your LAN, send a Message::GetService message as a UDP broadcast to port 56700. When a device is discovered, the Service types and IP port are provided. To get additional info about each device, send additional Get messages directly to each device (by setting the FrameAddress::target field to the bulbs target ID, and then send a UDP packet to the IP address associated with the device).

§Reserved fields

When constructing packets, you must always set every reserved field to zero. However, it’s possible to receive packets with these fields set to non-zero values. Be conservative in what you send, and liberal in what you accept.

§Unknown values

It’s common to see packets for LIFX bulbs that don’t match the documented protocol. These are suspected to be internal messages that are used by official LIFX apps, but that aren’t documented.

Structs§

BuildOptions
Options used to construct a RawMessage.
EchoPayload
Frame
The Frame section contains information about the following:
FrameAddress
The Frame Address section contains the following routing information:
HSBK
Bulb color (Hue-Saturation-Brightness-Kelvin)
LifxIdent
LifxString
Lifx strings are fixed-length (32-bytes maximum)
ProductInfo
ProtocolHeader
RawMessage
The raw message structure

Enums§

ApplicationRequest
Controls how/when multizone devices apply color changes
Error
Various message encoding/decoding errors
LastHevCycleResult
Message
Decoded LIFX Messages
MultiZoneEffectType
PowerLevel
Service
What services are exposed by the device.
TemperatureRange
Waveform

Functions§

describe_kelvin
Describe (in english words) the color temperature as given in kelvin.
get_product_info
Look up info about what a LIFX product supports.