initial commit

This commit is contained in:
2020-02-23 21:01:12 -06:00
parent 25fd03b1b1
commit 7358c00200
4 changed files with 99 additions and 0 deletions

24
cmd/lifx.go Normal file
View File

@ -0,0 +1,24 @@
package main
import (
"fmt"
"git.kill0.net/chill9/lifx"
"os"
"time"
)
func main() {
apiToken := os.Getenv("LIFX_API_TOKEN")
if apiToken == "" {
fmt.Println("LIFX_API_TOKEN is undefined")
os.Exit(1)
}
s := &lifx.State{Power: "on", Color: "white"}
c := lifx.NewSession(apiToken)
c.SetState("group:Office", s)
time.Sleep(10)
c.SetState("all", &lifx.State{Power: "on", Color: "green"})
time.Sleep(10)
c.SetState("all", &lifx.State{Power: "off"})
fmt.Println(lifx.EndpointState(lifx.Endpoint))
}