A Philips Hue CLI backed by the bridge's local CLIP v2 REST API — no cloud account, no Hue app. Setup may ask Philips's discovery service once where the bridge is; everything after that talks to the bridge directly.
huego is a single static binary that starts in milliseconds. Use it from
keybindings, status bars, scripts, and agents. Resource commands support
--json, failures have stable exit codes, and live changes stream from the
bridge.
Download the archive for your OS/arch from the
latest release,
extract it, and put huego (or huego.exe) on your PATH. Or build from
source:
go install github.com/mathisarends/huego@latesthuego setup # find the bridge via discovery.meethue.com
huego setup --ip 192.168.1.20 # or skip discoveryPress the link button when asked. Setup waits up to 60 seconds, then saves
the address and bridge keys to ~/.config/huego/bridge.json
(%AppData%\huego\bridge.json on Windows). Stdout reports bridge_ip and
config_path. If you previously consumed app_key or client_key from setup
JSON, use the saved configuration through the CLI or read the file at
config_path through your credential handling. If discovery returns multiple
bridges, setup --json exits with ambiguous and includes a bridges array
on stderr. Pass the selected internalipaddress to setup --ip.
The CLI recognizes HUEGO_BRIDGE_IP, HUEGO_APP_KEY, HUEGO_CLIENT_KEY,
and HUEGO_CONFIG_DIR in the environment or in .env in the working
directory. Process environment values take precedence over .env. A bridge
address and app key from these settings are sufficient to skip the saved
file. Otherwise, supplied settings override individual values in the file.
Setup and subsequent commands use the same configuration directory.
Relative config paths are relative to the working directory. Reads leave
the config directory untouched. Setup writes a temporary file in that
directory and replaces bridge.json after the new contents are written.
| Command | Subcommands |
|---|---|
light, room, zone |
list, get, update, identify |
home |
get, update, identify for the whole bridge |
scene |
list, get, create, update, activate, delete |
smart-scene |
list [--group GROUP], get, update <target> --active BOOL |
automation |
list, get, update <target> --enabled BOOL |
device |
list, get, update <device> --sensors-enabled BOOL — product, model, firmware, connectivity, battery, services |
sensor |
list [--type …], get <sensor-id>, update <sensor-id> --enabled BOOL |
bridge |
get — bridge ID, address, model, firmware, time zone |
events |
stream live changes, with --type, --timeout, and --limit |
api |
raw CLIP v2 request for anything without a dedicated command |
setup |
find a bridge and register huego with it |
completion |
shell completion script for bash, zsh, fish, or PowerShell |
Use update <target> for a light, room, or zone. Use home update for the
whole bridge. Combine the settings in one command for a single bridge write.
Rooms, zones, and the home act through their grouped light.
| Flag | Meaning |
|---|---|
--on, --on=false, --off, --toggle |
Choose one power operation. Toggle reads the current state first. |
-b, --brightness PERCENT |
Set brightness from 0 to 100. Zero turns the lights off. |
--brightness-delta POINTS |
Change brightness by a signed step, from -100 to 100. Dimming stops at the minimum. |
--color COLOR, --temperature KELVIN |
Choose a named color, hex RGB, or white temperature (2000-6536 K). |
--effect NAME |
Individual lights support effects listed by light get. Use none to stop. |
-t, --transition SECONDS |
Fade to the requested settings over this duration. |
Positive brightness, brightening, color and temperature also turn the lights
on unless you specify power. Choose one of color, temperature, or effect
for a light. RGB sets chromaticity. For example, #400000 selects red, and
--brightness 20 sets its dimming level. To request darkness, use --off
or zero brightness. The color flags reject black because it has no Hue
chromaticity. Saved-scene flags check the selected light's capabilities
while editing. Live updates send one write and let the bridge validate
dimming, chromaticity, and temperature. Effects require a read to select
the supported Hue effect format.
<target> is a UUID or a full name. Matching ignores case and surrounding
spaces. Scenes and smart scenes also accept <room or zone>/<name>. If a
literal name and a qualified name match different resources, use a UUID
from the ambiguity report. Shell completion and picker output use IDs when
names cannot identify a single resource.
huego light update "Desk Lamp" --color "#ff8800" --brightness 60 --transition 2
huego light update "Desk Lamp" --on=false --brightness 40
huego light update "Desk Lamp" --effect candle
huego room update Kitchen --brightness-delta -20
huego home update --off --transition 3
huego scene activate Office/Relax --dynamic
huego sensor list --type temperature
huego sensor update "$sensor_id" --enabled false
huego device update "Hallway sensor" --sensors-enabled false
huego api get light/<id>
huego smart-scene update "Office/Natural light" --active true
huego automation update "Weekday wake-up" --enabled false
huego api get behavior_instance/<id>Read the current state after an unconfirmed toggle or brightness delta
before deciding whether to retry. Repeating either operation applies it
again. A room, zone, or home with unavailable aggregate power has on: null
in JSON. Toggling it requires a known state. A contact report can have
open, closed, or unknown as its value.
Identify the room or zone and give each light its own settings. The command
below saves both actions in one request. Only the named lights are included.
Brightness, color, and temperature imply the same power state as a live update.
Use an explicit --off LIGHT to save a positive brightness for a light that
should remain off. Names and UUIDs both work, and flags can be repeated.
huego scene create Reading --room "Living room" --on Armchair --temperature Armchair=2700 --brightness Armchair=65 --on Sofa --color Sofa=gold --brightness Sofa=20
huego scene get "Living room/Reading" --json
huego scene update "Living room/Reading" --brightness Armchair=50 --remove-light Sofa
huego scene activate "Living room/Reading" -t 2
huego scene delete "Living room/Reading"With names containing spaces, quote the entire assignment, e.g.
--brightness "Desk lamp=40". update uses the same lighting flags and
preserves the other saved actions. A color or temperature change replaces
the light's previous color mode and effect. Use --effect to select an effect.
huego scene create Evening --room Office --capture
huego scene create Sunset --from Office/Evening --palette orange,pink,purple --speed 0.4 --auto-dynamic true
huego scene update Office/Sunset --capture --name Dusk--capture starts with all current lights in the group. --from starts
with a saved scene in its original group. Light flags can override either
starting point before the scene is written.
get --json shows the stored actions, palette and playback settings.
Pass its actions array to scene create or scene update with
--actions - (stdin) or --actions '<JSON array>'. The shape is
[{"target":{"rid":"<light ID or full name>","rtype":"light"},"action":{"on":{"on":true}}}].
Updates merge supplied fields into the stored actions and keep omitted
lights and fields. Use --replace-actions with --actions to supply the
complete array. An empty array with replacement clears the actions if
the bridge accepts it. Structured input uses native CLIP action fields
and lets the bridge validate those fields.
huego scene get Office/Reading --json | jq '.actions' |
huego scene create 'Reading copy' --room Office --actions -After activation, light get <light> --json reports the bridge's current
state. Use room update <target> --off or zone update <target> --off to switch off
its lights.
Serialize edits by scene UUID because Hue replaces the whole action array.
huego checks the array again before writing and reports conflict if it
changed. A writer can still update it between that check and the write.
Create and rename check the group and normalized name before writing.
Those checks can race with other writers. Coordinate concurrent operations
that use the same group and name. After an unconfirmed create, run
scene list --group <group-id> --json, then use scene get <id> --json to
compare any match with the intended scene before retrying.
- Data commands accept
--json. Lists return an array, including[]for no matches.getreturns an object. Successful writes report a bridge acknowledgment. Room, zone, and home update receipts includetarget: {id, type}for the addressed group,affected: [{id, type}]for the acknowledged services, and the originaldataanderrorsfields. Get the resource afterward when you need its observed state. list --namesprints one usable target per line. Sensor targets are IDs. Use either--namesor--json. Help, version, and completion keep their text or shell formats. A command group without a subcommand prints help in text mode and returnsusagein JSON mode.- A terminal JSON diagnostic on stderr has
errorandcode. Anambiguousdiagnostic for a resource includescandidateswith unique IDs. Scene consumers that previously used the qualified labels incandidatescan displaymatches[].displayand pass a candidate ID back. setup --jsonandevents --jsonwrite newline-delimited diagnostics to stderr. Progress records haveeventandmessage. A reconnect record also hasretry_after_ms. Parse the terminal error by itscode.events --jsonwrites one changed resource per line withidfor the resource andevent_idfor the bridge event. Several resources can share an event ID. Names reflect the inventory at each connection and can be absent when lookup fails or a resource is new. Events can be lost during a disconnect.--limitcounts matching records. With--timeout, a connected stream that yields no matching records may exit 0 with empty stdout. Failure to establish a stream before the timeout returns an error. A permanent endpoint error ends the stream.api --jsonprints the compact response when the body is valid JSON. Non-2xx responses use the HTTP error mapping. A 2xx response with CLIPerrorsexits 1 withbridge_error, and a 2xx response with an invalid JSON body exits 1 withinvalid_responseand includes the original text inresponse_bodyon stderr. Valid response bodies remain on stdout on failure, including acknowledgment data from partial success. Text mode also prints non-JSON response bodies.- A failed multi-sensor update may emit confirmed receipts to stdout.
Its stderr error includes
sensor_progresswithconfirmed,rejected,unknown, andpendingsensor IDs. Read the unknown IDs withsensor get <id> --jsonto check their state before retrying. - An output write failure stops the command. A closed pipe can end the producer with SIGPIPE on Unix or an output error on platforms that return a write failure. Consumers that deliberately close the pipe early can account for the producer's exit status.
| Exit code | code |
Meaning |
|---|---|---|
| 0 | success | |
| 1 | error, bridge_error, invalid_response |
operation failed or the bridge response was invalid |
| 1 | already_exists, conflict, unsupported_setting, state_unknown |
use existing ID, reread before retrying, choose a supported setting, or read the current state |
| 1 | config_invalid, config_unreadable |
configuration is malformed or could not be read |
| 2 | usage |
invalid command input. Local checks run before configuration or bridge access. Bridge-dependent checks may read inventory. |
| 3 | not_found, ambiguous |
no resource, or more than one, matches the name |
| 4 | not_configured, unauthorized |
run huego setup, or the app key was revoked |
| 5 | unreachable |
the bridge did not answer |
For a light, kelvin is the observed white temperature, --temperature
sets it, and capabilities.temperature indicates support.
capabilities.temperature_kelvin holds the advertised range when available.
For a smart scene, state is the bridge's status string and active is
true, false, or null for an unrecognized status. Write the schedule state
with smart-scene update --active true|false.
Use the installed CLI as an external integration. internal/hue is the Go
client for use within this repository.
import json
import subprocess
result = subprocess.run(
["huego", "light", "get", "Desk Lamp", "--json"],
capture_output=True,
text=True,
encoding="utf-8",
)
if result.returncode:
diagnostic = json.loads(result.stderr)
raise RuntimeError(f"{result.returncode} {diagnostic['code']}: {diagnostic['error']}")
light = json.loads(result.stdout)
print(light["id"])go build ./...
go test ./...
./scripts/format.sh # gofumpt + gci
./scripts/lint.sh # golangci-lint
./scripts/check-coverage.sh # go test -cover, threshold defaults to 90hueify, the Python client huego was ported from, which also covers entertainment-area streaming.