Documentation
¶
Index ¶
- Constants
- type Action
- type Bulb
- func (y *Bulb) Discover() (*YeelightParams, error)
- func (y *Bulb) EnsureOn() error
- func (y *Bulb) ExecuteCommand(name string, params ...interface{}) (*CommandResult, error)
- func (y *Bulb) GetProps(props []string) (*PropsResult, error)
- func (y *Bulb) IsOn() (bool, error)
- func (y *Bulb) Listen() (<-chan *Notification, chan<- struct{}, error)
- func (y *Bulb) SetBrightness(brightness int) (*CommandResult, error)
- func (y *Bulb) SetBrightnessWithDuration(brightness int, duration int) (*CommandResult, error)
- func (y *Bulb) SetHSV(hue int, saturation int) (*CommandResult, error)
- func (y *Bulb) SetName(name string) (*CommandResult, error)
- func (y *Bulb) SetRGB(rgba color.RGBA) (*CommandResult, error)
- func (y *Bulb) StartFlow(flow *Flow) (*CommandResult, error)
- func (y *Bulb) StopFlow() (*CommandResult, error)
- func (y *Bulb) TurnOff() (*CommandResult, error)
- func (y *Bulb) TurnOn() (*CommandResult, error)
- func (y *Bulb) TurnOnWithParams(mode Mode, duration int) (*CommandResult, error)
- type BulbConfig
- type Command
- type CommandResult
- type EffectType
- type Error
- type Flow
- type LightType
- type Mode
- type Notification
- type PropsResult
- type YeelightParams
Constants ¶
View Source
const ( Recover Action = 0 Stay = 1 Off = 2 )
View Source
const ( Last Mode = 0 Normal = 1 RGB = 2 HSV = 3 ColorFlow = 4 Moonlight = 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bulb ¶
type Bulb struct {
// contains filtered or unexported fields
}
Bulb represents device
func New ¶
func New(config BulbConfig) *Bulb
func (*Bulb) Discover ¶
func (y *Bulb) Discover() (*YeelightParams, error)
func (*Bulb) ExecuteCommand ¶
func (y *Bulb) ExecuteCommand(name string, params ...interface{}) (*CommandResult, error)
func (*Bulb) Listen ¶
func (y *Bulb) Listen() (<-chan *Notification, chan<- struct{}, error)
Listen connects to device and listens for NOTIFICATION events
func (*Bulb) SetBrightness ¶
func (y *Bulb) SetBrightness(brightness int) (*CommandResult, error)
func (*Bulb) SetBrightnessWithDuration ¶
func (y *Bulb) SetBrightnessWithDuration(brightness int, duration int) (*CommandResult, error)
func (*Bulb) StopFlow ¶
func (y *Bulb) StopFlow() (*CommandResult, error)
func (*Bulb) TurnOff ¶
func (y *Bulb) TurnOff() (*CommandResult, error)
func (*Bulb) TurnOn ¶
func (y *Bulb) TurnOn() (*CommandResult, error)
func (*Bulb) TurnOnWithParams ¶
func (y *Bulb) TurnOnWithParams(mode Mode, duration int) (*CommandResult, error)
type Command ¶
type Command struct { ID int `json:"id"` Method string `json:"method"` Params []interface{} `json:"params"` }
Command represents COMMAND request to Bulb device
type CommandResult ¶
type CommandResult struct { ID int `json:"id"` Result []interface{} `json:"result,omitempty"` Error *Error `json:"error,omitempty"` }
CommandResult represents response from Bulb device
type Flow ¶
type Flow struct {
// contains filtered or unexported fields
}
func (*Flow) AsStartParams ¶
func (flow *Flow) AsStartParams() []interface{}
type Notification ¶
Notification represents notification response
Click to show internal directories.
Click to hide internal directories.