amoinier / yeelight

Golang API for Yeelight

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status License MIT Go Report Card Code Coverage

yeelight

Golang API for Yeelight

Overview

Yeelight is simple command line tool and Golang implementation API of Yeelight protocol with notification listening support

Installation

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

Usage

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()

}

API Specification

Yeelight API Specification [can be found here] (https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf)

License

yeelight is distributed under the MIT license

Legal

Yeelight® is a registered trademark of Yeelight.

About

Golang API for Yeelight

License:MIT License


Languages

Language:Go 87.4%Language:Makefile 12.6%