For documentation, check out the link to godoc above.
To start using the hue API, you first need to register your device.
package main
import "fmt"
import "github.com/stefanwichmann/go.hue"
func main() {
bridges, _ := hue.DiscoverBridges(false)
bridge := bridges[0] //Use the first bridge found
//Remember to push the button on your hue first
err := bridge.CreateUser("my nifty app")
if err != nil {
fmt.Printf("Device registration failed: %v\n", err)
}
fmt.Printf("Registered new device => %+v\n", bridge)
}
package main
import "github.com/stefanwichmann/go.hue"
func main() {
bridge := hue.NewBridge("your-ip-address", "your-device-name")
lights, _ := bridge.GetAllLights()
for _, light := range lights {
light.On()
}
}
package main
import "github.com/stefanwichmann/go.hue"
func main() {
bridge := hue.NewBridge("your-ip-address", "your-device-name")
lights, _ := bridge.GetAllLights()
for _, light := range lights {
light.ColorLoop()
}
}
package main
import "github.com/stefanwichmann/go.hue"
func main() {
bridge := hue.NewBridge("your-ip-address", "your-device-name")
light, _ := bridge.FindLightByName("Bathroom Light")
light.On()
}