Golang API for Yeelight
Yeelight is simple command line tool and Golang implementation API of Yeelight protocol with notification listening support
Make sure you have a working Go environment. See Golang install instructionshttp://golang.org/doc/install.html)
To install, run:
go get github.com/avarabyeu/yeelight
func main() {
y, err := yeelight.Discover()
checkError(err)
on, err := y.GetProp("power")
checkError(err)
fmt.Printf("Power is %s", on[0].(string))
notifications, done, err := y.Listen()
checkError(err)
go func() {
<-time.After(time.Second)
done <- struct{}{}
}()
for n := range notifications {
fmt.Println(n)
}
context.Background().Done()
}
Yeelight API Specification [can be found here] (https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf)
yeelight is distributed under the MIT license
Yeelight® is a registered trademark of Yeelight.