Documentation ¶
Index ¶
- Constants
- Variables
- type WizClient
- func (w *WizClient) GetDevInfo() (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) GetModelConfig() (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) GetPilot() (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) GetSystemConfig() (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) GetUserConfig() (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) IsDw() (bool, error)
- func (w *WizClient) IsRgb() (bool, error)
- func (w *WizClient) IsSceneAvailable(sceneId int) (available bool, err error)
- func (w *WizClient) IsTw() (bool, error)
- func (w *WizClient) Pulse() (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) Registration(phoneIp string, phoneMac string, register bool) (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) SetBrightness(brightness int) (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) SetColdWhite(coldWhite int) (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) SetRatio(ratio int) (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) SetRgb(r, g, b int) (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) SetRhythm(rhythmId int) (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) SetScene(sceneId int) (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) SetSpeed(speed int) (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) SetTemperature(temperature int) (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) SetWarmWhite(warmWhite int) (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) TurnOff() (response wizgotypes.WizMessageResponse, err error)
- func (w *WizClient) TurnOn() (response wizgotypes.WizMessageResponse, err error)
Constants ¶
const ( // Info messages BrithnessRangeMessage = "brightness must be between 10 and 100" LedRangeMessage = "LED colors must be between 0 and 255" TemperatureRangeMessage = "temperature value must be between 2000 and 9000 (kelvin)" SpeedRangeMessage = "speed must be between 10 and 200" RatioRangeMessage = "ratio must be between 1 and 100" // Error messages ErrorReceivingResponseErrorMessage = "error receiving response: %s" ErrorSendingDataErrorMessage = "error sending data: %s" SystemConfigNotAvailableErrorMessage = "error getting system config: %s" DeviceTypeNotFoundErrorMessage = "error figuring out device type: %s" SceneNotAvailableErrorMessage = "scene not available: %s" )
Variables ¶
var ( // TODO WizScenes = map[int]string{ 1: "Ocean", 2: "Romance", 3: "Sunset", 4: "Party", 5: "Fireplace", 6: "Cozy", 7: "Forest", 8: "Pastel Colors", 9: "Wake up", 10: "Bedtime", 11: "Warm White", 12: "Daylight", 13: "Cool white", 14: "Night light", 15: "Focus", 16: "Relax", 17: "True colors", 18: "TV time", 19: "Plantgrowth", 20: "Spring", 21: "Summer", 22: "Fall", 23: "Deepdive", 24: "Jungle", 25: "Mojito", 26: "Club", 27: "Christmas", 28: "Halloween", 29: "Candlelight", 30: "Golden white", 31: "Pulse", 32: "Steampunk", 33: "Diwali", 35: "Light alarm", 1000: "Rhythm", } // TW - have Cool White and Warm White LEDs. Such devices support most static light modes + CCT control WizTwScenes = []int{6, 9, 10, 11, 12, 13, 14, 15, 16, 18, 29, 30, 31, 32} // DW - have only Dimmable white LEDs. Such devices support only dimming, Wake up, Bedtime and Night light modes. WizDwScenes = []int{9, 10, 13, 14, 29, 30, 31, 32} )
Functions ¶
This section is empty.
Types ¶
type WizClient ¶
type WizClient struct {
// contains filtered or unexported fields
}
func CreateWizClient ¶
TODO
func (*WizClient) GetDevInfo ¶
func (w *WizClient) GetDevInfo() (response wizgotypes.WizMessageResponse, err error)
GetDevInfo return current configuration related to the device
func (*WizClient) GetModelConfig ¶
func (w *WizClient) GetModelConfig() (response wizgotypes.WizMessageResponse, err error)
GetModelConfig return current configuration related to the device model
func (*WizClient) GetPilot ¶
func (w *WizClient) GetPilot() (response wizgotypes.WizMessageResponse, err error)
GetPilot return the current status for colors, temperature, scenes, etc
func (*WizClient) GetSystemConfig ¶
func (w *WizClient) GetSystemConfig() (response wizgotypes.WizMessageResponse, err error)
GetSystemConfig return current configuration related to the system
func (*WizClient) GetUserConfig ¶
func (w *WizClient) GetUserConfig() (response wizgotypes.WizMessageResponse, err error)
GetUserConfig return current configuration related to the user
func (*WizClient) IsDw ¶
IsDw return true when the device have only dimmable white LEDs. These type of devices support only dimming and some light modes
func (*WizClient) IsRgb ¶
IsRgb return true when the device have RGB, cool white and warm white LEDs. These type of bulbs can support all the light modes provided by WiZ
func (*WizClient) IsSceneAvailable ¶
IsSceneAvailable todo
func (*WizClient) IsTw ¶
IsTw return true when the device have cool white and warm white LEDs. These type of devices support most static light modes + CCT control
func (*WizClient) Pulse ¶
func (w *WizClient) Pulse() (response wizgotypes.WizMessageResponse, err error)
Pulse generate a pulse of light to locate the bulb with ease
func (*WizClient) Registration ¶
func (w *WizClient) Registration(phoneIp string, phoneMac string, register bool) (response wizgotypes.WizMessageResponse, err error)
Registration is used to "register" with the bulb. This notifies the bulb if you want it to send you heartbeat sync packets After registering, you will receive on port 38900/udp of registered device, several messages like the following: {"method":"syncPilot","env":"pro","params":{"mac":"ABCABCABC","rssi":-71,"src":"udp","state":true,"sceneId":0,"temp":6500,"dimming":62 ··· }}
func (*WizClient) SetBrightness ¶
func (w *WizClient) SetBrightness(brightness int) (response wizgotypes.WizMessageResponse, err error)
SetBrightness change the device's brightness (10-100)
func (*WizClient) SetColdWhite ¶
func (w *WizClient) SetColdWhite(coldWhite int) (response wizgotypes.WizMessageResponse, err error)
SetColdWhite set the level of light given by cold white LEDs (0-255)
func (*WizClient) SetRatio ¶
func (w *WizClient) SetRatio(ratio int) (response wizgotypes.WizMessageResponse, err error)
TODO
func (*WizClient) SetRgb ¶
func (w *WizClient) SetRgb(r, g, b int) (response wizgotypes.WizMessageResponse, err error)
SetRgb set the color for the device (3 x 0-255)
func (*WizClient) SetRhythm ¶
func (w *WizClient) SetRhythm(rhythmId int) (response wizgotypes.WizMessageResponse, err error)
SetRhythm set a rhythm by its ID. TODO: Implementation pending as it requires deeper reverse engineering to figure out what is needed There are three potential methods involved: setSchdPset, setSchd, setPilot
func (*WizClient) SetScene ¶
func (w *WizClient) SetScene(sceneId int) (response wizgotypes.WizMessageResponse, err error)
SetScene set a scene by its ID. The availability of IDs depend on the type of bulb: RBG, TW, DW
func (*WizClient) SetSpeed ¶
func (w *WizClient) SetSpeed(speed int) (response wizgotypes.WizMessageResponse, err error)
SetSpeed set changing speed between the colors in a scene
func (*WizClient) SetTemperature ¶
func (w *WizClient) SetTemperature(temperature int) (response wizgotypes.WizMessageResponse, err error)
SetTemperature set color temperature in kelvin
func (*WizClient) SetWarmWhite ¶
func (w *WizClient) SetWarmWhite(warmWhite int) (response wizgotypes.WizMessageResponse, err error)
SetWarmWhite set the level of light given by warm white LEDs (0-255)
func (*WizClient) TurnOff ¶
func (w *WizClient) TurnOff() (response wizgotypes.WizMessageResponse, err error)
TurnOff turns off the device
func (*WizClient) TurnOn ¶
func (w *WizClient) TurnOn() (response wizgotypes.WizMessageResponse, err error)
TurnOn turns on the device