For use with Philips Hue lights.
Define and orchestrate lighting scenes from the commandline.
Once you have Go installed:
$ go get https://github.com/bruce/huesceneHuescene configuration are defined using YAML.
Here's a simple example:
scenes:
- name: work
lights:
- name: Office
color: "#fab444"
brightness: 255
- name: Desk
color: "#fff"
brightness: 200More examples can be found in the examples/ directory.
The configuration should have a scenes key containing a list of scene configurations.
Scene configurations have a name and, optionally, the following fields that act as defaults for the associated lights:
power-trueorfalsecolor- A hexidecimal color string, e.g.,#fab444brightness-0–255
A scene's lights are defines as a list under its lights key.
Light configurations have a name and can override the power, color, and brightness settings that are set as defaults in their scenes.
All commands must be run from within the same network as your Philips Hue Bridge.
Huescene currently automatically attempts to create a username (API key) using your Hue Bridge if a key isn't already provided.
At the moment, the workflow is a bit clumsy 😭 and looks like this:
- You try one of the commands below, but you don't provide a key. It fails with a noisy
"link button not pressed"error. - You press the Hue Bridge link button and (within 30 seconds, reattempt the command). Now (instead of the command you really want to run) you get the API key output. A somewhat qualified success!
- You optionally store the API key in your configuration file (under the
keytoplevel field) so you don't have to provide it as--keyin future commands. - You run the commands you want (see below) passing the key in your configuration file or as
--key.
👷♂️ In the future, there will be a separate flag to trigger authentication more explicitly. You know, like you'd expect!
To set a specific scene, simply provide its name as an argument. For instance, if our config file in path/to/config.yml had a work scene defined, this would activate it:
$ huescene -c path/to/config.yml workNote that a --key option must be provided for authentication reasons unless your configuration provides it (in a toplevel key field).
You can also pipe the configuration into huescene:
$ cat path/to/config.yml | huescene workObviously to configure lights, you need to know what they're named. Use the --list-lights flag.
If you're storing your API key in your config file (key field), you can provide the configuration as usual with -c or --config,
$ huescene -c path/to/config.yml --list-lightsYou can also just pass the key directory:
$ huescene --key YOUR_API_KEY --list-lightsSee LICENSE.