A Go library to manage your Philips Hue devices
Go
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.travis.yml
README.md
bridge.go
bridge_test.go
client.go
discover.go
discover_test.go
light.go
light_test.go
result.go
result_test.go

README.md

go.hue

GoDoc

An easy to use api to manage your phillips hue. For documentation, check out the link to godoc above.

Example - Register a New Device

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

Example - Turn on all the lights

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

Example - Disco Time! Turn all lights on with colorloop

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

Example - Easy Access to Lights

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