Hju lets you control your Hue lights straight from the command line!
Supports all color gamut conversions (for RGB mode) specified by Hue documentation to date (as of 2016-12).
Requirements:
You can run the script directly or, better, build an executable first with roswell.
ros build hju.ros
Ensure you have an user registered on Hue bridge for this application (in the future, this process will be done from this tool, but now it has to be done manually). Refer to Hue API documentation for this process.
$ ./hju --help
hju - a simple command line controller for Hue lights
Version: 0.5
Usage:
hju [options...] <command> [args]
Use "hju -h" or "hju --help" for complete list of options.
Options:
-h, --help Display this text.
-v, --verbose Make output verbose.
-b BRIDGE, --bridge=BRIDGE Use different bridge URL than the default.
-u USER, --user=USER Use different user ID than the default.
-t TRANSITION, --transition=TRANSITION Use specified transition time (in tenths of a second).
TRANSITION is given in seconds, can be fractional. Default value: 0.4.
Terminate options with -- if -h or -v is used last.
Defaults are taken from the config file .hju in your home directory.
The format of that file is:
(setf *bridge-url* "bridge URL" *user-id* "USER ID")
Commands:
status Display status of Hue bridge and all lights.
list Just list available lights and their status.
on LIGHTS Turn on LIGHTS.
off LIGHTS Turn off LIGHTS.
toggle LIGHTS Toggle LIGHTS.
reset LIGHTS Reset LIGHTS to the values I (the author) like.
blink LIGHTS Blink LIGHTS.
set LIGHTS rgb R G B Set color of LIGHTS to rgb(R, G, B) (each component in [0.0 ... 1.0]).
set LIGHTS rgb #RRGGBB Set color of LIGHTS to #RRGGBB (hex).
set LIGHTS rgb #RGB Set color of LIGHTS to #RRGGBB (hex).
set LIGHTS hue HUE Set hue of LIGHTS to HUE [0...65535].
set LIGHTS sat SAT Set saturation of LIGHTS to SAT [0...254].
set LIGHTS bri BRI Set brightness of LIGHTS to BRI [1...254].
set LIGHTS ct CT Set color temperature of LIGHTS to CT in Mired.
set LIGHTS ctk CTK Set color temperature of LIGHTS to CTK in Kelvins.
set LIGHTS xy X Y Set color of LIGHTS to coordinates (X, Y) in CIE color space.
LIGHTS can be given as a comma-separated list of numbers or prefixes of their names.
LIGHTS can also be given as "all", which will make the command affect all lights.
Examples:
hju on living,bathroom
hju off bat
hju set 1,3 rgb #11FF11
Hju searches for its configuration file in following places:
$HOME/.hju
$HOME/.config/hju/.hju
If a configuration file is present there, it will be loaded, making it no longer required to pass bridge URL and user ID as command line arguments.
The template for config file is as follows:
(setf *bridge-url* "IP address of your Hue bridge"
*user-id* "your user ID")
See issues for a list of planned features and known problems.