Versions in this module Expand all Collapse all v1 v1.0.0 May 25, 2025 Changes in this version + const HeaderSize + const LifxPort + const Protocol + var BroadcastAddress = net.UDPAddr + var ProductsByVendorIDAndProductID map[int]map[int]Product + func BuildDiscoveryPacket(source uint32) []byte + func BuildEchoRequestPacket(source uint32, target []byte, echo []byte) []byte + func BuildGetLabelPacket(source uint32, target []byte) []byte + func BuildGetVersionPacket(source uint32, target []byte) []byte + func BuildSetColorPacket(source uint32, target []byte, color LIFXColor, duration time.Duration) []byte + func BuildSetLabelPacket(source uint32, target []byte, label string) []byte + func BuildSetPowerPacket(source uint32, target []byte, on bool) []byte + func InitializeProducts() error + func PrintProduct(product Product) + func SanitizeLabel(label string) string + type Client struct + func NewClient() (*Client, error) + func (c *Client) BroadcastPacket(packet []byte) error + func (c *Client) ClearDevices() + func (c *Client) Close() error + func (c *Client) Discover(timeout time.Duration) error + func (c *Client) ExportJSON() string + func (c *Client) GetDeviceByLabel(label string) (*Device, error) + func (c *Client) GetDeviceLabels() []string + func (c *Client) GetDevices() []Device + func (c *Client) LoadDevices(jsonData string) error + func (c *Client) RefreshDeviceInfo() + func (c *Client) Send(packet []byte, addr *net.UDPAddr) error + func (c *Client) SendAndWait(packet []byte, addr *net.UDPAddr, expectedType PacketType, ...) ([]byte, error) + func (c *Client) SetColor(label string, color LIFXColor, duration time.Duration) error + func (c *Client) SetLabel(oldLabel, newLabel string) error + func (c *Client) TurnOff(label string) error + func (c *Client) TurnOn(label string) error + type Device struct + IP net.IP + Label string + MAC []byte + Product Product + func NewDevice(mac []byte, ip net.IP, c *Client) *Device + func (d *Device) ExportDeviceJSON() string + func (d *Device) GetLabel() (string, error) + func (d *Device) GetMACAddress() string + func (d *Device) GetProduct() (Product, error) + func (d *Device) Ping() bool + func (d *Device) RefreshInfo() error + func (d *Device) Send(packet []byte) error + func (d *Device) SendAndWait(packet []byte, pktType PacketType, duration time.Duration) ([]byte, error) + func (d *Device) SetColor(color LIFXColor, duration time.Duration) error + func (d *Device) SetLabel(label string) error + func (d *Device) TurnOff() error + func (d *Device) TurnOn() error + func (d *Device) UDPAddr() *net.UDPAddr + type Features struct + Buttons bool + Chain bool + Color bool + ExtendedMultizone bool + Hev bool + Infrared bool + Matrix bool + Multizone bool + Relays bool + TemperatureRange [2]int + type Header [HeaderSize]byte + func DefaultHeader(source uint32, target []byte, packetType PacketType, payloadSize uint16) *Header + func NewHeader(source uint32) *Header + func ParseHeader(data []byte) (*Header, error) + func (h *Header) AckRequired() bool + func (h *Header) Addressable() bool + func (h *Header) PackHeader() []byte + func (h *Header) Protocol() uint16 + func (h *Header) ResponseRequired() bool + func (h *Header) Sequence() uint8 + func (h *Header) SetAckRequired(ackRequired bool) + func (h *Header) SetAddressable(addressable bool) + func (h *Header) SetResponseRequired(responseRequired bool) + func (h *Header) SetSequence(sequence uint8) + func (h *Header) SetSize(size uint16) + func (h *Header) SetSource(source uint32) + func (h *Header) SetTagged(tagged bool) + func (h *Header) SetTarget(mac []byte) + func (h *Header) SetType(packetType PacketType) + func (h *Header) Size() uint16 + func (h *Header) Source() uint32 + func (h *Header) Tagged() bool + func (h *Header) Target() []byte + func (h *Header) Type() PacketType + type LIFXColor struct + func ColorfulToLifxColor(color colorful.Color) LIFXColor + func NewColor(hue, saturation, brightness, kelvin uint16) LIFXColor + func NewColorFromHSV(h, s, v float64) LIFXColor + func NewColorFromHex(hex string) (LIFXColor, error) + func NewColorFromRGB(r, g, b uint8) LIFXColor + func (c *LIFXColor) GetBrightness() float64 + func (c *LIFXColor) GetHue() float64 + func (c *LIFXColor) GetKelvin() float64 + func (c *LIFXColor) GetSaturation() float64 + func (c *LIFXColor) SetBrightness(brightness float64) + func (c *LIFXColor) SetHue(hue float64) + func (c *LIFXColor) SetKelvin(kelvin float64) + func (c *LIFXColor) SetSaturation(saturation float64) + type PacketType uint16 + const Acknowledgement + const EchoRequest + const EchoResponse + const Get64 + const GetColor + const GetColorZones + const GetDeviceChain + const GetExtendedColorZones + const GetGroup + const GetHevCycle + const GetHevCycleConfiguration + const GetHostFirmware + const GetInfo + const GetInfrared + const GetLabel + const GetLastHevCycleResult + const GetLightPower + const GetLocation + const GetMultiZoneEffect + const GetPower + const GetRPower + const GetService + const GetTileEffect + const GetVersion + const GetWifiFirmware + const GetWifiInfo + const LightState + const SensorGetAmbientLight + const Set64 + const SetColor + const SetColorZones + const SetExtendedColorZones + const SetGroup + const SetHevCycle + const SetHevCycleConfiguration + const SetInfrared + const SetLabel + const SetLightPower + const SetLocation + const SetMultiZoneEffect + const SetPower + const SetRPower + const SetReboot + const SetTileEffect + const SetUserPosition + const SetWafeformOptional + const SetWaveform + const State64 + const StateAmbientLight + const StateDeviceChain + const StateExtendedColorZones + const StateGroup + const StateHevCycle + const StateHevCycleConfiguration + const StateHostFirmware + const StateInfo + const StateInfrared + const StateLabel + const StateLastHevCycleResult + const StateLightPower + const StateLocation + const StateMultiZone + const StateMultiZoneEffect + const StatePower + const StateRPower + const StateService + const StateTileEffect + const StateUnhandled + const StateVersion + const StateWifiFirmware + const StateWifiInfo + const StateZone + type Product struct + Features Features + Name string + ProductID int + Upgrades []struct{ ... } + func GetProduct(vendorID, productID int) (Product, error) + type Vendor struct + Defaults Features + Name string + Products []Product + VendorID int