Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrDiscoverNoDeviceFound is returned when no device is found when discovering ErrDiscoverNoDeviceFound = errors.New("no device found") )
Functions ¶
This section is empty.
Types ¶
type Method ¶
type Method string
Method describes the method string to send to a yeelight device.
const ( SetColorTemperatureABX Method = "set_ct_abx" SetRGB Method = "set_rgb" SetHSV Method = "set_hsv" SetBrightness Method = "set_bright" SetPower Method = "set_power" Toggle Method = "toggle" GetProp Method = "get_prop" Props Method = "props" AdjustBrightness Method = "adjust_bright" AdjustColorTemperature Method = "adjust_ct" )
Currently supported commands
type Notification ¶
Notification describes a change on Yeelight
type Response ¶
type Response struct { ID int `json:"id"` Result []interface{} `json:"result"` Error *struct { Code int `json:"code"` Message string `json:"message"` } `json:"error"` }
Response describes command response from a yeelight device
type Yeelight ¶
type Yeelight interface { fmt.Stringer // On turns on the yeelight On() error // Off turns the yeelight Off() error // SetColorTemperature will set the yeelight color temperature SetColorTemperature(temperature int) error // SetRGB will set yeelight red, green and blue values SetRGB(red, green, blue uint8) error // SetBrightness will set the yeelight brightness. SetBrightness(brightness int) error // IsPowerOn return whether the yeelight is power on IsPowerOn() (bool, error) // Toggle on or off the Yeelight Toggle() error // Listen for events on current Yeelight Listen(ctx context.Context) (<-chan *Notification, error) // AdjustBrightness adjust the brightness by specified percentage within specified duration. // The percentage range is: (-100,100). // duration is in milliseconds and minimum is 30ms. AdjustBrightness(percentage int, duration int) error // AdjustColorTemperature adjust the color temperature by specified percentage within specified duration. // The percentage range is: (-100,100). // duration is in milliseconds and minimum is 30ms. AdjustColorTemperature(percentage int, duration int) error }
Yeelight is a light device you want to control
Click to show internal directories.
Click to hide internal directories.