{"id":24283063,"url":"https://github.com/s222em/hue.ts","last_synced_at":"2025-09-25T02:31:39.398Z","repository":{"id":37060898,"uuid":"457040889","full_name":"S222em/hue.ts","owner":"S222em","description":"A powerful library to interact with the Hue API","archived":true,"fork":false,"pushed_at":"2024-09-09T17:39:24.000Z","size":507,"stargazers_count":2,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-03T09:59:37.203Z","etag":null,"topics":["api","hue","javascript","library"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/S222em.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}},"created_at":"2022-02-08T17:45:53.000Z","updated_at":"2024-09-12T13:22:45.000Z","dependencies_parsed_at":"2024-02-19T19:31:46.646Z","dependency_job_id":"089eda0e-62b0-4d2b-9d3c-74607216d38d","html_url":"https://github.com/S222em/hue.ts","commit_stats":{"total_commits":125,"total_committers":5,"mean_commits":25.0,"dds":0.248,"last_synced_commit":"cfd655467838930ad3f1cb167363b0243c381c87"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/S222em/hue.ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S222em%2Fhue.ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S222em%2Fhue.ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S222em%2Fhue.ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S222em%2Fhue.ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/S222em","download_url":"https://codeload.github.com/S222em/hue.ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S222em%2Fhue.ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276848171,"owners_count":25715255,"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-09-25T02:00:09.612Z","response_time":80,"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":["api","hue","javascript","library"],"created_at":"2025-01-16T03:56:15.445Z","updated_at":"2025-09-25T02:31:39.110Z","avatar_url":"https://github.com/S222em.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n[![MIT License][license-shield]][license-url]\n\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about\"\u003eAbout\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#example-usage\"\u003eExample usage\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#colors\"\u003eColors\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#other\"\u003eOther\u003c/a\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#roadmap\"\u003eRoadmap\u003c/a\u003e\n    \u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\u003e ⚠️ Library is under construction and may not work as expected\n\n# About\n\nhue.ts is a node module that allows you to easily interact with the hue API (V2).\n\n- Object-oriented\n- Written in TypeScript\n- Future 100%-coverage of the hue API (v2)\n\n# Installation\n\n\u003e ⚠️ **Hue bridge version 1948086000 or newer is required**: You can find your bridge's version in\nthe hue app, Settings -\u003e My Hue system -\u003e Select your bridge -\u003e Software\n\n```shell\nnpm install hue.ts\n```\n\n# Example usage\n\nThis examples goal is to create a new zone, and adding a scene to this zone.\n\n```shell\nnpm install hue.ts\n```\n\nBefore connecting to your hue bridge, its ip address and an application key are required.\nThe ip address can be found in the Hue app at Settings -\u003e My hue system -\u003e Select your bridge -\u003e IP\nAfter, an application key can be acquired by the following method:\n1. Open your browser and go to `https://\u003cbridge ip address\u003e/debug/clip.html`\n2. Next fill in the options below:\n   URL: /api\n   BODY: {\"devicetype\":\"some-random-name\"}\n3. Press the POST button\n4. Go click the button on your Hue bridge\n5. Press the POST button again\n6. You should now see something like `{ success: { username: 'some-key' } }`\n\nFor more information on retrieving this key visit: https://developers.meethue.com/develop/hue-api-v2/getting-started/\n\n```ts\nimport { Hue, ArcheType, SceneAction } from 'hue.ts';\n\n// Create new Hue, with the ip address and application key\nconst hue = new Hue({\n   connection: {\n      ip: 'some-ip',\n      applicationKey: 'some-key',\n   },\n});\n\n// Listen to the 'ready' event, which is emitted when the socket has connected and cached all resources\nhue.on('ready', async () =\u003e {\n   // Get the lights we want in the new zone\n   const light1 = hue.lights.cache.find((light) =\u003e light.name == 'Demo Light 1')!;\n   const light2 = hue.lights.cache.find((light) =\u003e light.name == 'Demo Light 2')!;\n\n   // Create the zone\n   await hue.zones.create({\n      name: 'Demo',\n      archeType: ArcheType.ManCave,\n      children: [light1.id, light2.id],\n   });\n});\n\n// Listen to the 'zoneAdd' event, emitted on creation of a new zone\nhue.on('zoneAdd', async (zone) =\u003e {\n    // Ignore if the zone is not the one created above\n   if (zone.name !== 'Demo') return;\n\n   // Find the lights belonging to the zone again, in this case these will be Demo Light 1 \u0026 Demo Light 2\n   const lights = hue.lights.cache.filter((light) =\u003e zone.childIds.includes(light.id));\n\n   // Make the actions\n   const actions = lights.map((light) =\u003e {\n      const action: SceneAction = {\n         id: light.id,\n         on: true,\n      };\n\n      // Check if the light can do dimming, and if so, set the brightness of the light to 50%\n      if (light.isCapableOfDimming()) action.brightness = 50;\n\n      // Check if the light can display color, and if so, set the color to #eb403\n      if (light.isCapableOfColor()) action.color = fromHex('#eb403');\n\n      return action;\n   });\n\n   // Create the scene\n   await zone.createScene({\n      name: 'Awesome scene',\n      actions,\n   });\n});\n\n// Listen to the sceneAdd event, emitted on creation of a new scene\nhue.on('sceneAdd', async (scene) =\u003e {\n    // Ignore if not the scene just created above\n   if (scene.name !== 'Awesome scene') return;\n\n   // Recall the scene\n   await scene.recall();\n});\n```\n# Colors\n\nColors... get more complicated. The hue system uses the C.I.E. color representation. This representation is a 2D-colored diagram.\nThis also means, to get a color of this diagram, a coordinate (position on the horizontal and vertical axes) is needed.\nA color is therefor represented as `{ x: number; y: number }`. Where x is the horizontal placement and y the vertical.\n\n![cie-url]\n\nAs this is a sort of 'non-standard' color representation, utility functions are provided to convert a rgb/hex value to C.I.E.\n```ts\nconst xy = fromHex('#eb4034');\n\nawait light.setColor(xy);\n```\n```ts\nconst xy = fromRGB({\n   red: 235,\n   green: 64,\n   blue: 52,\n});\n\nawait light.setColor(xy);\n```\n```ts\nconst hex = toHex(light.color);\n```\n```ts\nconst rgb = toRGB(light.color);\n```\n\nAs also visible in the C.I.E. above, defined by the triangles,\nthere is a limit to what the light is able to display.\nBecause of that, there might be a difference of your input and the color of the light.\nIn order to calculate the color the light is currently showing, the following method can be used.\n```ts\nconst xy = light.colorToRange(light.color);\n\nconst hex = toHex(xy);\n```\n\n# Links\n\n- [Documentation](documentation-url)\n- [GitHub](github-url)\n- [npm](npm-url)\n\n# Help\n\nFor questions or issues, please open an issue on our [github](issues-url) page.\n\n[contributors-shield]: https://img.shields.io/github/contributors/S222em/hue.js.svg?style=for-the-badge\n[contributors-url]: https://github.com/S222em/hue.js/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/S222em/hue.js.svg?style=for-the-badge\n[forks-url]: https://github.com/S222em/hue.js/network/members\n[stars-shield]: https://img.shields.io/github/stars/S222em/hue.js.svg?style=for-the-badge\n[stars-url]: https://github.com/S222em/hue.js/stargazers\n[issues-shield]: https://img.shields.io/github/issues/S222em/hue.js.svg?style=for-the-badge\n[issues-url]: https://github.com/S222em/hue.js/issues\n[license-shield]: https://img.shields.io/github/license/S222em/hue.js.svg?style=for-the-badge\n[license-url]: https://github.com/S222em/hue.js/blob/master/LICENSE.txt\n[cie-url]: https://developers.meethue.com/wp-content/uploads/2018/02/color.png\n[documentation-url]: https://github.com/S222em/hue.ts/wiki/Exports\n[github-url]: https://github.com/S222em/hue.ts\n[npm-url]: https://www.npmjs.com/package/hue.ts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs222em%2Fhue.ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs222em%2Fhue.ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs222em%2Fhue.ts/lists"}