Package hue interfaces Philips Hue devices to control lights, scenes, schedules, and groups.
HueBeat by Mobilpadde - Light up a room in sync with your heartbeat.
BitHue by ytcracker - Light color according to profit gain/loss in bitcoin price
go get github.com/collinux/gohue
package main
import (
"github.com/collinux/gohue"
)
func main() {
// It is recommended that you save the username from bridge.CreateUser
// so you don't have to press the link button every time and re-auth.
// When CreateUser is called it will print the generated user token.
bridgesOnNetwork, _ := hue.FindBridges()
bridge := bridgesOnNetwork[0]
username, _ := bridge.CreateUser("someusernamehere")
bridge.Login(username)
lights, _ := bridge.GetAllLights()
for _, light := range lights {
light.SetBrightness(100)
light.ColorLoop(true)
}
nightstandLight, _ := bridge.GetLightByName("Nightstand")
nightstandLight.Blink(5)
nightstandLight.SetName("Bedroom Lamp")
lights[0].SetColor(hue.RED)
lights[1].SetColor(hue.BLUE)
lights[2].SetColor(hue.GREEN)
for _, light := range lights {
light.Off()
}
}
- Set the environment variable "HUE_USER_TOKEN"
(example:
export HUE_USER_TOKEN="sby7xirR87dUpnfzp1yGRVBeP0Zoxo3LH1krNxSi"
) - Run
go test *_test.go
- Wait for all covered tests to be executed (Estimated 15 seconds - may vary depending on network latency).
- Get all lights
- Get light by name
- Get light by index on bridge
- Get lights attributes and state
- Set lights attributes (rename)
- Set light state (color, effects, brightness, etc)
- Delete light
- Turn On, Off, Toggle
- Blink
- Colorloop On/Off
- Create user
- Delete user
- Get configuration
- Modify configuration
- Get full state (datastore)
- Search for bridges
- Search for new lights
- Get all timezones
- Get all schedules
- Get schedule by ID
- Get schedule attributes
- Create schedules
- Set schedule attributes
- Delete schedule
- Get all scenes
- Get scene by ID
- Create scene
- Modify scene
- Recall scene
- Delete scene
- Get all groups
- Create group
- Get group attributes
- Set group attributes
- Set group state
- Delete Group
- Get all sensors
- Create sensor
- Find new sensors
- Get new sensors
- Get sensor
- Update sensor
- Delete sensor
- Change sensor configuration
- Get all rules
- Get rule
- Create rule
- Update rule
- Delete rule
This repository is featured on the Philips Hue® developer site and was not developed by "Philips Lighting Holding B.V"... for official Hue® documentation check out the Philips Hue® website. This codebase comes with no guaranetees. Use at your own risk.
GoHue - Third party golang library for Philips Hue® gateway interface. Copyright (C) 2016 Collinux GPL version 2 or higher http://www.gnu.org/licenses/gpl.html
Pull requests happily accepted on GitHub