mirror of
https://github.com/gosticks/go-hue-interface.git
synced 2025-10-16 11:45:35 +00:00
| monitor | ||
| utils | ||
| .gitignore | ||
| bridge.go | ||
| config.go | ||
| config.yaml | ||
| go.mod | ||
| go.sum | ||
| groups_test.go | ||
| groups.go | ||
| INFO.md | ||
| LICENSE | ||
| lights_test.go | ||
| lights.go | ||
| README.md | ||
| scene.go | ||
| state.go | ||
| time.go | ||
| TODO.md | ||
| user.go | ||
go-hue-interface
Connect to a hue bridge
In your code create a hue bridge instance
func main() {
// ...
// create a bridge config
bridgeConf := &Config{
Username: "YOUR_DEVICE_USERNAME", // check below for detailed instructions
BridgeAddr: "YOUR_BRIDGE_IP_ADDR", // check below where to find the ip address of the hue
BridgeAddrScheme: "http",
}
// create bridge
bridge := NewBridge(config)
// now do stuff with bridge
// get ligts as a map of lights over ids
lights, errLights := bridge.GetLights()
if errLights {
fmt.Println("Failed to get lights")
}
// Turn all lights on
for id, _ := range lights {
bridge.ToggleLight(id, true)
}
}