Skip to content

savaki/go.hue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

74c6f74 · Jan 7, 2014

History

17 Commits
Dec 10, 2013
Dec 24, 2013
Jan 7, 2014
Jan 7, 2014
Dec 23, 2013
Dec 11, 2013
Dec 23, 2013
Jan 7, 2014
Dec 10, 2013
Dec 23, 2013
Dec 10, 2013
Dec 10, 2013

Repository files navigation

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

About

A Go library to manage your Philips Hue devices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages