Documentation
¶
Index ¶
- Constants
- type Command
- type Error
- type Response
- type Yeelight
- func (y *Yeelight) CronAdd(t, value int) (Response, error)
- func (y *Yeelight) CronDel(t int) (Response, error)
- func (y *Yeelight) CronGet(t int) (Response, error)
- func (y *Yeelight) GetProp() error
- func (y *Yeelight) Off() (Response, error)
- func (y *Yeelight) On() (Response, error)
- func (y *Yeelight) SetAdjust(action, prop string) (Response, error)
- func (y *Yeelight) SetBright(brightness, duration int) (Response, error)
- func (y *Yeelight) SetCtAbx(value, duration int) (Response, error)
- func (y *Yeelight) SetDefault() (Response, error)
- func (y *Yeelight) SetHSV(hue, sat, duration int) (Response, error)
- func (y *Yeelight) SetName(name string) (Response, error)
- func (y *Yeelight) SetPower(power string, duration int) (Response, error)
- func (y *Yeelight) SetRGB(red, green, blue, duration int) (Response, error)
- func (y *Yeelight) SetRGBhex(value, duration int) (Response, error)
- func (y *Yeelight) SetScene(class, values string) (Response, error)
- func (y *Yeelight) StartCf(count, action int, flowExpression string) (Response, error)
- func (y *Yeelight) StopCf() (Response, error)
- func (y *Yeelight) Toggle() (Response, error)
Constants ¶
const Port = "55443"
Port is the default Yeelight port
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { ID int `json:"id"` Method string `json:"method"` Params interface{} `json:"params"` }
Command to send to the light
type Response ¶
type Response struct { ID int `json:"id"` Result interface{} `json:"result,omitempty"` Error Error `json:"error,omitempty"` }
Response sent by the light
type Yeelight ¶
type Yeelight struct { Location string `json:"location"` ID string `json:"id,omitempty"` Model string `json:"model,omitempty"` FWVersion int `json:"fw_ver,omitempty"` Support []string `json:"support,omitempty"` Power string `json:"power,omitempty"` Bright int `json:"bright,omitempty"` ColorMode int `json:"color_mode,omitempty"` ColorTemp int `json:"ct,omitempty"` RGB int `json:"rgb,omitempty"` Hue int `json:"hue,omitempty"` Saturation int `json:"sat,omitempty"` Name string `json:"name"` }
Yeelight are the light properties
func Discover ¶
Discover uses SSDP to find and return the IP address of the lights credit: https://github.com/edgard/yeelight/blob/master/yeelight.go
func (*Yeelight) CronGet ¶
CronGet method is used to retrieve the setting of the current cron job of the specified type.
func (*Yeelight) SetAdjust ¶
SetAdjust method is used to change brightness, CT or color of a smart LED without knowing the current value, it's main used by controllers.
func (*Yeelight) SetDefault ¶
SetDefault method is used to save current state of smart LED in persistent memory. So if user powers off and then powers on the smart LED again (hard power reset), the smart LED will show last saved state.
func (*Yeelight) SetName ¶
SetName method is used to name the device. The name will be stored on the device and reported in discovering response. User can also read the name through “get_prop” method
func (*Yeelight) SetPower ¶
SetPower method is used to switch on or off the smart LED (software managed on/off).
func (*Yeelight) SetRGB ¶
SetRGB method is used to change the color RGB of a smart LED (red, green, blue from 0-255).
func (*Yeelight) SetRGBhex ¶
SetRGBhex method is used to change the color RGB of a smart LED (using hexadecimal).
func (*Yeelight) SetScene ¶
SetScene method is used to set the smart LED directly to specified state. If the smart LED is off, then it will turn on the smart LED firstly and then apply the specified command.
func (*Yeelight) StartCf ¶
StartCf method is used to start a color flow. Color flow is a series of smart LED visible state changing. It can be brightness changing, color changing or color temperature changing.This is the most powerful command. All our recommended scenes, e.g. Sunrise/Sunset effect is implemented using this method. With the flow expression, user can actually “program” the light effect.