Documentation
¶
Overview ¶
Package device implements a LIFX LAN protocol version 2 device.
This package is not designed to be accessed by end users, all interaction should occur via the Client in the golifx package.
Index ¶
- Constants
- Variables
- type Device
- func (d *Device) CachedFirmwareVersion() string
- func (d *Device) CachedGroup() string
- func (d *Device) CachedHardwareProduct() uint32
- func (d *Device) CachedHardwareVendor() uint32
- func (d *Device) CachedHardwareVersion() uint32
- func (d *Device) CachedLabel() string
- func (d *Device) CachedLocation() string
- func (d *Device) CachedPower() bool
- func (d *Device) CachedProduct() *Product
- func (d *Device) Close() error
- func (d *Device) Discover() error
- func (d *Device) GetAddress() *net.UDPAddr
- func (d *Device) GetFirmwareVersion() (ret string, err error)
- func (d *Device) GetGroup() (ret string, err error)
- func (d *Device) GetHardwareProduct() (uint32, error)
- func (d *Device) GetHardwareVendor() (uint32, error)
- func (d *Device) GetHardwareVersion() (uint32, error)
- func (d *Device) GetLabel() (string, error)
- func (d *Device) GetLocation() (ret string, err error)
- func (d *Device) GetPower() (bool, error)
- func (d *Device) GetProduct() (*Product, error)
- func (d *Device) GetProductName() (string, error)
- func (d *Device) Handle(pkt *packet.Packet)
- func (d *Device) ID() uint64
- func (d *Device) Provisional() bool
- func (d *Device) ResetLimiter()
- func (d *Device) Seen() time.Time
- func (d *Device) Send(pkt *packet.Packet, ackRequired, responseRequired bool) (packet.Chan, error)
- func (d *Device) SetLabel(label string) error
- func (d *Device) SetPower(state bool) error
- func (d *Device) SetProvisional(provisional bool)
- func (d *Device) SetSeen(seen time.Time)
- func (d *Device) SetStateGroup(pkt *packet.Packet) error
- func (d *Device) SetStateHostFirmware(pkt *packet.Packet) error
- func (d *Device) SetStateLabel(pkt *packet.Packet) error
- func (d *Device) SetStateLocation(pkt *packet.Packet) error
- func (d *Device) SetStatePower(pkt *packet.Packet) error
- type Feature
- type GenericDevice
- type Group
- func (g *Group) AddDevice(dev GenericDevice) error
- func (g *Group) CachedColor() common.Color
- func (g *Group) CachedPower() bool
- func (g *Group) Close() error
- func (g *Group) Devices() (devices []common.Device)
- func (g *Group) GetColor() (common.Color, error)
- func (g *Group) GetLabel() string
- func (g *Group) GetPower() (bool, error)
- func (g *Group) ID() string
- func (g *Group) Lights() []common.Light
- func (g *Group) Parse(pkt *packet.Packet) error
- func (g *Group) RemoveDevice(dev GenericDevice) error
- func (g *Group) SetColor(color common.Color, duration time.Duration) error
- func (g *Group) SetPower(state bool) error
- func (g *Group) SetPowerDuration(state bool, duration time.Duration) error
- type Light
- func (l *Light) CachedColor() common.Color
- func (l *Light) Get() error
- func (l *Light) GetColor() (common.Color, error)
- func (l *Light) SetColor(color common.Color, duration time.Duration) error
- func (l *Light) SetPowerDuration(state bool, duration time.Duration) error
- func (l *Light) SetState(pkt *packet.Packet) error
- type Location
- type Product
- type Vendor
Constants ¶
View Source
const ( GetService shared.Message = 2 StateService shared.Message = 3 GetHostInfo shared.Message = 12 StateHostInfo shared.Message = 13 GetHostFirmware shared.Message = 14 StateHostFirmware shared.Message = 15 GetWifiInfo shared.Message = 16 StateWifiInfo shared.Message = 17 GetWifiFirmware shared.Message = 18 StateWifiFirmware shared.Message = 19 GetPower shared.Message = 20 SetPower shared.Message = 21 StatePower shared.Message = 22 GetLabel shared.Message = 23 SetLabel shared.Message = 24 StateLabel shared.Message = 25 GetVersion shared.Message = 32 StateVersion shared.Message = 33 GetInfo shared.Message = 34 StateInfo shared.Message = 35 Acknowledgement shared.Message = 45 GetLocation shared.Message = 48 StateLocation shared.Message = 50 GetGroup shared.Message = 51 StateGroup shared.Message = 53 EchoRequest shared.Message = 58 EchoResponse shared.Message = 59 )
Variables ¶
View Source
var ( // Vendors automatically generated from products.json Vendors = map[uint32]Vendor{ 1: Vendor{ ID: 1, Name: `LIFX`, Products: map[uint32]*Product{ 1: &Product{ID: 1, VendorID: 1, Name: `Original 1000`, Features: 2}, 3: &Product{ID: 3, VendorID: 1, Name: `Color 650`, Features: 2}, 10: &Product{ID: 10, VendorID: 1, Name: `White 800 (Low Voltage)`, Features: 0}, 11: &Product{ID: 11, VendorID: 1, Name: `White 800 (High Voltage)`, Features: 0}, 18: &Product{ID: 18, VendorID: 1, Name: `White 900 BR30 (Low Voltage)`, Features: 0}, 20: &Product{ID: 20, VendorID: 1, Name: `Color 1000 BR30`, Features: 2}, 22: &Product{ID: 22, VendorID: 1, Name: `Color 1000`, Features: 2}, 27: &Product{ID: 27, VendorID: 1, Name: `LIFX A19`, Features: 2}, 28: &Product{ID: 28, VendorID: 1, Name: `LIFX BR30`, Features: 2}, 29: &Product{ID: 29, VendorID: 1, Name: `LIFX+ A19`, Features: 6}, 30: &Product{ID: 30, VendorID: 1, Name: `LIFX+ BR30`, Features: 6}, 31: &Product{ID: 31, VendorID: 1, Name: `LIFX Z`, Features: 6}, 36: &Product{ID: 36, VendorID: 1, Name: `LIFX Downlight`, Features: 2}, 37: &Product{ID: 37, VendorID: 1, Name: `LIFX Downlight`, Features: 2}, 43: &Product{ID: 43, VendorID: 1, Name: `LIFX A19`, Features: 2}, 44: &Product{ID: 44, VendorID: 1, Name: `LIFX BR30`, Features: 2}, 45: &Product{ID: 45, VendorID: 1, Name: `LIFX+ A19`, Features: 6}, 46: &Product{ID: 46, VendorID: 1, Name: `LIFX+ BR30`, Features: 6}, }, }, } )
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { common.SubscriptionProvider sync.RWMutex // contains filtered or unexported fields }
func (*Device) CachedFirmwareVersion ¶ added in v0.4.1
func (*Device) CachedGroup ¶ added in v0.3.4
func (*Device) CachedHardwareProduct ¶ added in v0.4.0
func (*Device) CachedHardwareVendor ¶ added in v0.4.0
func (*Device) CachedHardwareVersion ¶ added in v0.4.0
func (*Device) CachedLabel ¶ added in v0.4.0
func (*Device) CachedLocation ¶ added in v0.3.4
func (*Device) CachedPower ¶ added in v0.3.0
func (*Device) CachedProduct ¶ added in v1.0.0
func (*Device) GetAddress ¶
func (*Device) GetFirmwareVersion ¶ added in v0.4.1
func (*Device) GetHardwareProduct ¶
func (*Device) GetHardwareVendor ¶
func (*Device) GetHardwareVersion ¶
func (*Device) GetLocation ¶ added in v0.2.0
func (*Device) GetProduct ¶ added in v1.0.0
func (*Device) GetProductName ¶ added in v1.0.0
func (*Device) Provisional ¶ added in v0.4.1
func (*Device) ResetLimiter ¶
func (d *Device) ResetLimiter()
func (*Device) SetProvisional ¶ added in v0.4.1
func (*Device) SetStateGroup ¶ added in v0.2.0
func (*Device) SetStateHostFirmware ¶ added in v0.4.1
func (*Device) SetStateLocation ¶ added in v0.2.0
type Feature ¶ added in v1.0.0
type Feature uint32
Feature flags for devices
func FeatureString ¶ added in v1.0.0
type GenericDevice ¶
type GenericDevice interface { common.Device Handle(*packet.Packet) Close() error Seen() time.Time SetSeen(time.Time) Provisional() bool SetProvisional(bool) SetStatePower(*packet.Packet) error SetStateLabel(*packet.Packet) error SetStateLocation(*packet.Packet) error SetStateGroup(*packet.Packet) error GetLocation() (string, error) CachedLocation() string GetGroup() (string, error) CachedGroup() string GetProduct() (*Product, error) ResetLimiter() }
type Group ¶ added in v0.2.0
type Group struct { common.SubscriptionProvider sync.RWMutex // contains filtered or unexported fields }
func (*Group) AddDevice ¶ added in v0.2.0
func (g *Group) AddDevice(dev GenericDevice) error
func (*Group) CachedColor ¶ added in v0.3.0
func (*Group) CachedPower ¶ added in v0.3.0
func (*Group) RemoveDevice ¶ added in v0.2.0
func (g *Group) RemoveDevice(dev GenericDevice) error
type Light ¶
type Light struct { *Device // contains filtered or unexported fields }
func (*Light) CachedColor ¶ added in v0.3.0
func (*Light) SetPowerDuration ¶
type Product ¶ added in v1.0.0
func (*Product) UnmarshalJSON ¶ added in v1.0.0
Click to show internal directories.
Click to hide internal directories.