{"id":13508641,"url":"https://github.com/xavier/huex","last_synced_at":"2026-02-19T07:02:15.051Z","repository":{"id":23624341,"uuid":"26993889","full_name":"xavier/huex","owner":"xavier","description":"Elixir client for Philips Hue connected light bulbs","archived":false,"fork":false,"pushed_at":"2019-02-16T23:58:35.000Z","size":67,"stargazers_count":64,"open_issues_count":1,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-12-02T01:11:35.518Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xavier.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}},"created_at":"2014-11-22T08:57:08.000Z","updated_at":"2025-10-26T17:43:41.000Z","dependencies_parsed_at":"2022-08-21T20:20:11.422Z","dependency_job_id":null,"html_url":"https://github.com/xavier/huex","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/xavier/huex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavier%2Fhuex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavier%2Fhuex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavier%2Fhuex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavier%2Fhuex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xavier","download_url":"https://codeload.github.com/xavier/huex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xavier%2Fhuex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29605801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-08-01T02:00:56.097Z","updated_at":"2026-02-19T07:02:14.984Z","avatar_url":"https://github.com/xavier.png","language":"Elixir","funding_links":[],"categories":["Miscellaneous"],"sub_categories":[],"readme":"# Huex\n\nElixir client for Philips Hue connected light bulbs.\n\n## Installation\n\nAdd Huex as a dependency in your `mix.exs` file.\n\n```elixir\ndef deps do\n  [{:huex, \"~\u003e 0.8\"}]\nend\n```\n\nAlso add HTTPoison as part of your applications, in your `mix.exs` file.\n\n```elixir\ndef application do\n  [mod: {YourApp, []},\n   applications: [:httpoison]]\nend\n```\n\n\nAfter you are done, run `mix deps.get` in your shell to fetch and compile Huex.\n\n## Usage\n\n### First Connection\n\nIn order to issue queries and commands to the bridge, we need to request an authorization for a so-called `devicetype` (see [Hue Configuration API](http://www.developers.meethue.com/documentation/configuration-api)) which is a string formatted as such: `my-app#my-device`.\n\n**Before requesting the authorization**: you must **press the link button** on your bridge device to start a 30 second window during which you may request an authorization as follow:\n\n```elixir\nbridge = Huex.connect(\"192.168.1.100\") |\u003e Huex.authorize(\"my-app#my-device\")\n\n# A random username is now set\nIO.puts bridge.username\n# YApVhLTwWUTlGJDo...\n\n# The bridge connection is now ready for use\nIO.inspect Huex.info(bridge)\n# %{\"config\" =\u003e ...}\n\n```\n\n### Subsequent Connections\n\nOnce a `devicetype` has been authorized with the bridge, there's no need to perform the authorization process again. In other words, you must **store the generated username** received set by `authorize/2`. With the username at hand, you can connect right away:\n\n```elixir\nbridge = Huex.connect(\"192.168.1.100\", \"YApVhLTwWUTlGJDo...\")\n\nIO.inspect Huex.info(bridge)\n# %{\"config\" =\u003e ...}\n\n```\n\n### Bridge IP address discovery\n\nYou may use `Huex.Discovery.discover/0` to retrieve a list of bridges on your network using [SSDP](https://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol):\n\n```elixir\nHuex.Discovery.discover\n# [\"192.168.1.43\"]\n```\n\nThis optional feature depends on [`nerves_ssdp_client`](https://hex.pm/packages/nerves_ssdp_client) which must be added explicitly to your own application dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:huex, \"~\u003e 0.7\"},\n   {:nerves_ssdp_client, \"~\u003e 0.1\"}]\nend\n```\n\n### Queries\n\nQuery functions return the message received from the bridge API.\n\n```elixir\nIO.inspect Huex.info(bridge)\n# %{\"config\" =\u003e %{\"UTC\" =\u003e \"1970-01-01T03:00:40\", \"dhcp\" =\u003e true,\n#   \"gateway\" =\u003e \"192.168.1.1\", \"ipaddress\" =\u003e \"192.168.1.100\",\n#    ...\n#   \"schedules\" =\u003e %{}}\n\nIO.inspect Huex.lights(bridge)\n# %{\"1\" =\u003e %{\"name\" =\u003e \"Lobby\"}, \"2\" =\u003e %{\"name\" =\u003e \"Living Room\"},\n#    \"3\" =\u003e %{\"name\" =\u003e \"Bedroom\"}}\n\nIO.inspect Huex.light_info(bridge, 1)\n# %{\"modelid\" =\u003e \"LCT001\", \"name\" =\u003e \"Lobby\",\n#   ...\n#   \"swversion\" =\u003e \"66009663\", \"type\" =\u003e \"Extended color light\"}\n```\n\n### Commands\n\nCommand functions return a `Huex.Bridge` struct and are thus chainable.\n\n```elixir\nbridge\n|\u003e Huex.turn_off(1)                                  # Turn off light 1\n|\u003e Huex.turn_on(2)                                   # Turn on light 2\n|\u003e Huex.set_color(2, {10000, 255, 255})              # HSV\n|\u003e Huex.set_color(2, {0.167, 0.04})                  # XY\n|\u003e Huex.set_color(2, Huex.Color.rgb(1, 0.75, 0.25))  # RGB (see limitations)\n|\u003e Huex.set_brightness(2, 0.75)                      # Brightness at 75%\n```\n\n#### Error Handling\n\nFor error handling, the `Huex.Bridge` struct has a `status` attribute which is either set to `:ok` or `:error` by command functions.\n\nWhen an error occured, the complete error response is stored in the `error` attribute of the `Huex.Bridge` struct.\n\n### Examples\n\nLook into the `examples` directory for more advanced usage examples.\n\n## Current Limitations\n\nColor space conversion from RGB to XY currently feels a little fishy: I can't seem to get bright green or red using the given formula.\n\n## To Do\n\n- [ ] Reliable color conversion from RGB\n\n## Contributors\n\nIn order of appearance:\n\n* Xavier Defrang ([xavier](https://github.com/xavier))\n* Brandon Hays ([tehviking](https://github.com/tehviking))\n* Brian Davis ([mrbriandavis](https://github.com/mrbriandavis))\n* Pete Kazmier ([pkazmier](https://github.com/pkazmier))\n* Derek Kraan ([derekkraan](https://github.com/derekkraan))\n* Arijit Dasgupta ([arijitdasgupta](https://github.com/arijitdasgupta))\n\n## License\n\nCopyright 2014 Xavier Defrang\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n```\nhttp://www.apache.org/licenses/LICENSE-2.0\n```\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxavier%2Fhuex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxavier%2Fhuex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxavier%2Fhuex/lists"}