{"id":51771860,"url":"https://github.com/erikg/hue","last_synced_at":"2026-07-20T02:03:50.402Z","repository":{"id":371190426,"uuid":"1271620644","full_name":"erikg/hue","owner":"erikg","description":"Unofficial CLI + REST API daemon for controlling Philips Hue lights, designed for scripting and headless deployment","archived":false,"fork":false,"pushed_at":"2026-07-13T21:18:17.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-13T23:11:24.720Z","etag":null,"topics":["cli","daemon","flask","home-automation","hue","iot","philips-hue","python","rest-api","smart-lighting"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erikg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-16T21:10:27.000Z","updated_at":"2026-07-13T21:18:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/erikg/hue","commit_stats":null,"previous_names":["erikg/hue"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/erikg/hue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikg%2Fhue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikg%2Fhue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikg%2Fhue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikg%2Fhue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erikg","download_url":"https://codeload.github.com/erikg/hue/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikg%2Fhue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35670233,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-20T02:00:06.612Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","daemon","flask","home-automation","hue","iot","philips-hue","python","rest-api","smart-lighting"],"created_at":"2026-07-20T02:03:49.623Z","updated_at":"2026-07-20T02:03:50.397Z","avatar_url":"https://github.com/erikg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hue Control System\n\nAn unofficial, Python-based control system **for Philips Hue** lights, with both\na REST API daemon and a command-line interface suitable for scripting.\n\n## Features\n\n- **REST API Daemon**: HTTP API for controlling lights programmatically\n- **CLI Tool**: Command-line interface designed for scripting and automation\n- **Bridge Discovery**: Automatic discovery of Hue Bridge on the network\n- **Configuration Management**: Secure storage of bridge IP and API key\n\n## Installation\n\n1. Install dependencies:\n```bash\npip install -r requirements.txt\n```\n\n2. Make scripts executable:\n```bash\nchmod +x cli.py daemon.py\n```\n\n## Initial Setup\n\nRun the setup command to discover your bridge and authenticate:\n\n```bash\n./cli.py setup\n```\n\nThis will:\n1. Automatically discover your Hue Bridge\n2. Prompt you to press the link button on the bridge\n3. Create an API key and save it securely\n\n## CLI Usage\n\nThe CLI is designed for scripting and automation. All commands support `--json` flag for JSON output.\n\n### List all lights\n```bash\n./cli.py list\n./cli.py list --json  # JSON output\n```\n\n### Get light state\n```bash\n./cli.py get \u003clight_id\u003e\n./cli.py get 1 --json\n```\n\n### Turn lights on/off\n```bash\n./cli.py on \u003clight_id\u003e --on\n./cli.py on \u003clight_id\u003e --off\n```\n\n### Set brightness (0-254)\n```bash\n./cli.py brightness \u003clight_id\u003e 128\n```\n\n### Set color (HSB)\n```bash\n./cli.py color \u003clight_id\u003e --hue 10000 --sat 254 --bri 200\n```\n\n### Set color temperature (153-500 mireds)\n```bash\n./cli.py colortemp \u003clight_id\u003e 300\n```\n\n### Set state from JSON file\n```bash\necho '{\"on\": true, \"bri\": 200, \"hue\": 10000}' \u003e state.json\n./cli.py set \u003clight_id\u003e state.json\n```\n\n### Show configuration\n```bash\n./cli.py config\n```\n\n## REST API Daemon\n\nStart the daemon:\n```bash\n./daemon.py --host 0.0.0.0 --port 8080\n```\n\n### API Endpoints\n\n- `GET /health` - Health check\n- `GET /lights` - List all lights\n- `GET /lights/\u003clight_id\u003e` - Get light state\n- `PUT /lights/\u003clight_id\u003e/state` - Update light state (JSON body)\n- `PUT /lights/\u003clight_id\u003e/on` - Turn light on/off (`{\"on\": true/false}`)\n- `PUT /lights/\u003clight_id\u003e/brightness` - Set brightness (`{\"brightness\": 0-254}`)\n- `GET /config/bridge` - Get bridge IP\n- `GET /config/api_key` - Check if API key is configured (returns a masked value)\n\n`/config/bridge` and `/config/api_key` are read-only (GET-only) — there is no\nHTTP endpoint to set the bridge IP or API key. Config is set via\n`~/.hue/config.json` or the `HUE_BRIDGE_IP` / `HUE_API_KEY` environment\nvariables (see [Configuration](#configuration) below), never over the API.\n\n### Example API Usage\n\n```bash\n# List all lights\ncurl http://localhost:8080/lights\n\n# Get specific light\ncurl http://localhost:8080/lights/1\n\n# Turn light on\ncurl -X PUT http://localhost:8080/lights/1/on -H \"Content-Type: application/json\" -d '{\"on\": true}'\n\n# Set brightness\ncurl -X PUT http://localhost:8080/lights/1/brightness -H \"Content-Type: application/json\" -d '{\"brightness\": 200}'\n\n# Set custom state\ncurl -X PUT http://localhost:8080/lights/1/state -H \"Content-Type: application/json\" -d '{\"on\": true, \"bri\": 254, \"hue\": 10000, \"sat\": 254}'\n```\n\n## Configuration\n\nConfiguration is stored in `~/.hue/config.json` with restrictive permissions (600).\n\n### Environment variable overrides\n\nFor headless or automated deployments (systemd, cron, containers, CI), the\nbridge IP and API key can be supplied via environment variables instead of the\ninteractive `setup` flow. When set, these take **precedence** over the config\nfile:\n\n| Variable         | Overrides             |\n| ---------------- | --------------------- |\n| `HUE_BRIDGE_IP`  | `bridge_ip` in config |\n| `HUE_API_KEY`    | `api_key` in config   |\n\n```bash\nexport HUE_BRIDGE_IP=192.168.1.42\nexport HUE_API_KEY=your-hue-api-key\n./daemon.py --host 0.0.0.0 --port 8080\n```\n\nWith both set, no `~/.hue/config.json` is needed — neither the daemon nor the\nCLI will touch it for those values.\n\n## Scripting Examples\n\n### Bash script to toggle lights\n```bash\n#!/bin/bash\nLIGHT_ID=1\nSTATE=$(./cli.py get $LIGHT_ID --json | jq -r '.state.on')\nif [ \"$STATE\" = \"true\" ]; then\n    ./cli.py on $LIGHT_ID --off\nelse\n    ./cli.py on $LIGHT_ID --on\nfi\n```\n\n### Python script using REST API\n```python\nimport requests\n\nBASE_URL = \"http://localhost:8080\"\n\n# Turn on light 1\nresponse = requests.put(f\"{BASE_URL}/lights/1/on\", json={\"on\": True})\nprint(response.json())\n\n# Set brightness\nresponse = requests.put(f\"{BASE_URL}/lights/1/brightness\", json={\"brightness\": 200})\nprint(response.json())\n```\n\n## License\n\nMIT — see the [LICENSE](LICENSE) file.\n\n## Trademarks \u0026 Disclaimer\n\nThis is an independent, unofficial project for use with Philips Hue lighting.\nIt is **not affiliated with, authorized, endorsed by, or sponsored by** Signify\nN.V., Philips, or any of their subsidiaries or affiliates.\n\n\"Philips\" and \"Hue\" are trademarks of Signify Holding / Koninklijke Philips\nN.V. Those names are used here solely to identify the hardware this software is\ncompatible with (nominative use); no claim is made to them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikg%2Fhue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferikg%2Fhue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikg%2Fhue/lists"}