Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Releases

No releases published

Packages

No packages published

Languages