{"id":16592671,"url":"https://github.com/prikhi/hkhue","last_synced_at":"2025-08-25T21:09:47.215Z","repository":{"id":80049363,"uuid":"153826403","full_name":"prikhi/hkhue","owner":"prikhi","description":"A Daemon \u0026 CLI Client for Controlling Philips Hue Lights","archived":false,"fork":false,"pushed_at":"2021-06-18T20:30:12.000Z","size":178,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-14T08:39:02.243Z","etag":null,"topics":["cli","cli-client","color-temperature","daemon","haskell","hue","hue-api","hue-bridge","hue-lights","lights","redshift"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prikhi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2018-10-19T18:37:07.000Z","updated_at":"2024-12-12T02:49:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"5fb7db07-cef4-4461-82bf-d00bc922ba65","html_url":"https://github.com/prikhi/hkhue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/prikhi/hkhue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prikhi%2Fhkhue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prikhi%2Fhkhue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prikhi%2Fhkhue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prikhi%2Fhkhue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prikhi","download_url":"https://codeload.github.com/prikhi/hkhue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prikhi%2Fhkhue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272131810,"owners_count":24878988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"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","cli-client","color-temperature","daemon","haskell","hue","hue-api","hue-bridge","hue-lights","lights","redshift"],"created_at":"2024-10-11T23:21:52.805Z","updated_at":"2025-08-25T21:09:47.173Z","avatar_url":"https://github.com/prikhi.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hkhue\n\n[![HkHue Build Status](https://travis-ci.org/prikhi/hkhue.svg?branch=master)](https://travis-ci.org/prikhi/hkhue)\n\nA Haskell library \u0026 application for controlling Philips Hue lights.\n\n\n## Status\n\nThere is a daemon \u0026 CLI client, which currently supports:\n\n* Showing the current status of each light(name, on/off, color, brightness).\n* Showing the current status of each group.\n* Identifying lights by blinking them on \u0026 off.\n* Reseting all the lights to their default color temperature \u0026 brightness.\n* Setting the name of a light.\n* Setting the Brightness \u0026 Color-Temperature/RGB of specific lights(by name or\n  number), a group of lights(by name or number), or all lights - with custom\n  light-state transition times.\n* Scanning for new lights \u0026 associating them with the bridge.\n* Syncing the color temperature of your lights to redshift.\n\n\n## Ideas\n\nDunno exactly what I want but probably most of this:\n\n* Basic usage\n  * Groups\n    * Add light to group\n    * Remove light from group\n    * Create new group\n    * Rename group\n    * Delete group\n    * Add `-g` flag to `alert` command to limit to given groups\n  * Query light status\n    * Improve the XY -\u003e RGB conversion - sometimes the values are negative...\n  * Create/run preset scenes\n    * Scenes on Hue Bridge or in own database?\n    * Play scene but don't change current brightness!\n  * Global/Per-Light increments (brightness \u0026 color temp)\n  * Dameon Config file\n    * Support overriding config options w/ cli flags\n  * CLI Config file\n    * Support overriding config options w/ cli flags\n  * Add in-depth mode descriptions to CLI `--help` docs\n  * Nicer transition-time flag for CLI client - add support for values\n    like \"1s\", \"30m\", \"2h\"\n  * Show errors! \"Can't reach bridge\", \"Can't reach daemon\", \"Invalid color\n    channel value\", etc.\n  * Refactor DaemonState into separate module(as opaque type?). Ensure all Hue\n    API requests update the daemonBridgeState. E.g, so we can set name \u0026\n    immediately use it instead of having to wait for bridge sync.\n  * Clean Up Daemon Output, Support Log File or Verbosity Switches?\n  * Redshift syncing\n    * when making large ct jumps but with long transition times, the bridge\n      will return the final temperature for the first few seconds, then return\n      the actual current color temp. This causes redshift to flash from the\n      current temp to the target color temp and back. We should track when we\n      set the color temp w/ long transitions and modify the color temp we give\n      to the redshift-syncing client so that there is no initial flash. Maybe\n      lock the color temperature from being updated for 5-10 seconds(check how\n      long we need) or simply override the temperature for the average\n      calculations for some period of time.\n* Long/Constant effects\n  * Slowly brighten/dim over X number of minutes\n    * Currently have a script that slowly increases brightness \u0026 color\n      temp(at variable rates between various intervals) as I do my\n      morning routine. Ideally, would be customizable in web ui \u0026\n      present graph of colortemp vs time. Manual trigger lets me sync it\n      to my schedule instead of the daylight schedule, but it should act as the\n      \"base\" effect. De-activating an effect or scene should return the state\n      to the base effect.\n  * Constant slow fades between colors\n  * Breathing(brightness sine-wave)\n  * Flickering/Candlelight(brightness randomization?)\n  * Party mode\n  * Sound reactive\n  * Color based on computer monitor\n* Not so urgent\n  * Similar commands for controlling groups(or add a `-g group1,group2,etc`\n    flag).\n  * Better bridge pairing flow(prompt user through UI apps, not daemon),\n    autodiscovering\n  * Support multiple bridges \u0026 cross-bridge scenes\n  * `scan` command should wait 40s \u0026 print out any newly discovered lights.\n  * More `redshift` flags:\n    * `--single-light LIGHT_ID`\n    * `--on-only`\n    * `--pull` - instead of pushing color temp to redshift, pull color temp\n      from redshift\n* Code cleanup\n  * Add a REST interface as well for things that are awkward with websockets\n  * More function/API docs\n  * Add types for things like PercentBrightness, HueBrightness(1-254),\n    ByteChannel(0-255), UnitChannel(0-1), TransitionTime, etc.\n* Management Daemon\n  * Database for storing color bank, custom effects, scene\n  * Manages \u0026 cancels long-running effects\n* A GUI for manual control \u0026 CLI for scripting\n  * Elm for Web GUI?\n  * Websockets for Elm, Sockets for CLI? Or websockets for both?\n  * Color picker with live previews(toggle full room \u0026 single light)\n  * CLI mostly for scripting/playback(e.g., dim all by 10%), less important for\n    light setup/configuration?\n* Support all API features since I don't use the Hue app\n* Eventually support the Hue Entertainment Streaming API\n\n\n## Build / Run\n\nBuild the applications \u0026 start the daemon:\n\n```sh\nstack build\nstack exec hkhued\n```\n\nThen you can control the lights with the CLI client:\n\n```sh\nstack exec hkhue -- set-all -b 40 -c 255,0,255\n```\n\nRun `stack install` to install the binaries to `~/.local/bin/`:\n\n```sh\nstack install\nPATH=\"~/.local/bin:${PATH}\"\nhkhue set --on --color-temperature 2500 --brightness 75 --transition-time 300\nhkhue alert 1\nhkhue rename 1 ceiling\nhkhue set ceiling --color 255,0,255 -b 100 -t 100\nhkhue alert 2\nhkhue rename 2 desk\n# Sync redshift in the background\nhkhue redshift --interval 20 \u0026\n# Transition to 6000K over 10 minutes\nhkhue set ceiling desk -k 6000 -t \"$((10 * 60 * 10))\"\n```\n\nYou can install just the daemon or client by running `stack install\nhkhue:exe:hkhue` or `stack install hkhue:exe:hkhued`.\n\nTo see all available commands \u0026 flags, run `hkhue --help` or `hkhue \u003ccommand\u003e\n--help`.\n\n\n## Configuration\n\nYou can modify the default behavior of the daemon \u0026 CLI client by creating a\nconfig file at `~/.config/hkhue/config.yaml`. Global options are defined at the\ntop level while daemon \u0026 client options are nested under their respective keys.\nAll values are optional and will fall back to the following defaults:\n\n```yaml\n# The Address of the Daemon\nbind-address: 0.0.0.0\n# The Port for the Daemon to Use\nbind-port: 9160\n\ndaemon:\n    # The Hostname or Address of the Hue Bridge\n    bridge-host: philips-hue\n    # Seconds Between Full Bridge State Cache Resyncs\n    bridge-sync-interval: 60\n    # Seconds Between Light State Cache Resyncs\n    lights-sync-interval: 5\n\n# The default groups for the `wakeup` script\nwakeup:\n    groups:\n        - 1\n        - 4\n        - living-room\n```\n\n\n## Examples\n\n### Slowly Ramping Up Color Temperature\n\nThis script uses an array of (Color Temperature, Brightness, \u0026 Minutes) to\nslowly ramp up the light intensity as you wake up. See the `/examples/wakeup/`\nfolder for a Haskell implementation.\n\n```sh\n#!/usr/bin/env bash\n#\n# Gradually brighten \u0026 increase color temperature to ease waking up.\n# Starts at pure red \u0026 gets to 6500K in ~60 minutes.\n\necho \"[$(date +%T)] Starting wake up sequence.\"\n\necho \"[$(date +%T)] Turning on red lights at lowest brightness.\"\nhkhue set --on --wait --color 255,0,0 --brightness 1\n\nTEMP_RAMP=(\n  # KELVIN  BRIGHT% MINUTES\n    2000     10      5\n    2500     15      5\n    3000     30      7\n    3500     60      7\n    4250     80     10\n    5000    100     10\n    6500    100     15\n)\nRAMP_LEN=${#TEMP_RAMP[@]}\n\nfor (( INDEX=0; INDEX \u003c RAMP_LEN; INDEX=INDEX+3 )); do\n    COLOR_TEMP=\"${TEMP_RAMP[${INDEX}]}\"\n    BRIGHTNESS=\"${TEMP_RAMP[$((INDEX+1))]}\"\n    MINUTES=\"${TEMP_RAMP[$((INDEX+2))]}\"\n    TRANSITION_TIME=\"$(( 10 * 60 * MINUTES))\"\n    hkhue set --wait \\\n        -k \"${COLOR_TEMP}\" \\\n        -b \"${BRIGHTNESS}\" \\\n        -t \"${TRANSITION_TIME}\"\n    echo \"[$(date +%T)] Reached ${COLOR_TEMP}K and ${BRIGHTNESS}% brightness\" \\\n         \"in ${MINUTES} minute(s).\"\ndone\n\necho \"[$(date +%T)] Wake up sequence complete.\"\n```\n\n### Custom Color Loops\n\nThis script will loop through whichever RGB colors you like.\n\n```sh\n#!/usr/bin/env bash\n#\n# Loop through the specified RGB colors forever.\nSECONDS=5\nTRANSITION_TIME=\"$(( 10 * SECONDS ))\"\nCOLORS=(\n  # RED GRN BLU\n    255   0 255     # Magenta\n      0 255 255     # Cyan\n    255 127   0     # Orange\n      0 255   0     # Green\n)\nCOLORS_LEN=${#COLORS[@]}\nwhile true; do\n    for (( INDEX=0; INDEX \u003c COLORS_LEN; INDEX=INDEX+3 )); do\n        RED=\"${COLORS[${INDEX}]}\"\n        GREEN=\"${COLORS[$((INDEX+1))]}\"\n        BLUE=\"${COLORS[$((INDEX+2))]}\"\n        hkhue set --wait \\\n            -c \"${RED},${GREEN},${BLUE}\" \\\n            -t \"${TRANSITION_TIME}\"\n    done\ndone\n```\n\n\n## License\n\nGPL-3.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprikhi%2Fhkhue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprikhi%2Fhkhue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprikhi%2Fhkhue/lists"}