Documentation
¶
Index ¶
- type Device
- func (k *Device) FetchDeviceInfo(ctx context.Context) (*DeviceInfo, error)
- func (k *Device) FetchLightGroup(ctx context.Context) (*LightGroup, error)
- func (k *Device) FetchSettings(ctx context.Context) (*DeviceSettings, error)
- func (k *Device) UpdateLightGroup(ctx context.Context, newOptions *LightGroup) (*LightGroup, error)
- type DeviceInfo
- type DeviceSettings
- type Discovery
- type Light
- type LightGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
Device represents an actual KeyLight. They can be found using a Discovery interface, or created with a given DNSAddr and Port when running in a static environment.
func (*Device) FetchDeviceInfo ¶
func (k *Device) FetchDeviceInfo(ctx context.Context) (*DeviceInfo, error)
FetchDeviceInfo returns metadata for the accessory.
func (*Device) FetchLightGroup ¶
func (k *Device) FetchLightGroup(ctx context.Context) (*LightGroup, error)
FetchLightGroup returns all of the individual lights that are owned by an accessory. This in conjunction with UpdateLightGroup will allow you to control your lights.
func (*Device) FetchSettings ¶
func (k *Device) FetchSettings(ctx context.Context) (*DeviceSettings, error)
FetchSettings allows you to retrieve general device settings.
func (*Device) UpdateLightGroup ¶
func (k *Device) UpdateLightGroup(ctx context.Context, newOptions *LightGroup) (*LightGroup, error)
UpdateLightGroup allows you to update the settings for individual lights in an accessory. It returns the updated options.
type DeviceInfo ¶
type DeviceInfo struct {
ProductName string `json:"productName"`
HardwareBoardType int `json:"hardwareBoardType"`
FirmwareBuildNumber int `json:"firmwareBuildNumber"`
FirmwareVersion string `json:"firmwareVersion"`
SerialNumber string `json:"serialNumber"`
DisplayName string `json:"displayName"`
Features []string `json:"features"`
}
DeviceInfo returns read-only information about a given Elgato device. This is currently only supported by keylight devices but as other devices may expose _elg.tcp services, it may also be suppported by other products in the future.
type DeviceSettings ¶
type DeviceSettings struct {
PowerOnBehavior int `json:"powerOnBehavior"`
PowerOnBrightness int `json:"powerOnBrightness"`
PowerOnTemperature int `json:"powerOnTemperature"`
SwitchOnDurationMs int `json:"switchOnDurationMs"`
SwitchOffDurationMs int `json:"switchOffDurationMs"`
ColorChangeDurationMs int `json:"colorChangeDurationMs"`
}
DeviceSettings represents the data returned and accepted by a KeyLight for configuring its behaviour.
type Discovery ¶
type Discovery interface {
// Run will start the given discovery client and run syncronously until the
// provided context is shutdown.
Run(ctx context.Context) error
// ResultsCh returns a channel of discovered Key Lights.
// NOTE: It currently does not filter the results so may return non key light
// entities if they expose the `_elg._tcp` service over mdns.
// Use KeyLight.FetchDeviceInfo(...) to determine the accessory info
// if you run into problems.
ResultsCh() <-chan *Device
}
Discovery is the interface that is exposed to discover KeyLight devices. The default implementation discovers lights via Bonjour.
func NewDiscovery ¶
NewDiscovery returns a new default Disocvery implemetnation. This is currently backed by Bonjour.
type Light ¶
type Light struct {
On int `json:"on"`
Brightness int `json:"brightness"`
Temperature int `json:"temperature"`
}
Light is the struct that encapsulates the state of a KeyLight's individual light. Most keylight devices currently only have one 'Light'.
type LightGroup ¶
LightGroup represents a set of configurable lights within a given KeyLight device.
func (*LightGroup) Copy ¶
func (o *LightGroup) Copy() *LightGroup
Copy returns a new deep copy of a LightGroup.