An easy to use api to manage your phillips hue. 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"
"github.com/savaki/go.hue"
)
func main() {
locators, _ := hue.DiscoverBridges(false)
locator := locators[0] // find the first locator
deviceType := "my nifty app"
// remember to push the button on your hue first
bridge, _ := locator.CreateUser(deviceType)
fmt.Printf("registered new device => %+v\n", bridge)
}
package main
import (
"github.com/savaki/go.hue"
)
func main() {
bridge := hue.NewBridge("your-ip-address", "your-username")
lights, _ := bridge.GetAllLights()
for _, light := range lights {
light.On()
}
}
package main
import (
"github.com/savaki/go.hue"
)
func main() {
bridge := hue.NewBridge("your-ip-address", "your-username")
lights, _ := bridge.GetAllLights()
for _, light := range lights {
light.ColorLoop()
}
}
package main
import (
"github.com/savaki/go.hue"
)
func main() {
bridge := hue.NewBridge("your-ip-address", "your-username")
light, _ := bridge.FindLightByName("Bathroom Light")
light.On()
}