{"id":14985297,"url":"https://github.com/rektdeckard/hues","last_synced_at":"2025-04-10T23:50:43.361Z","repository":{"id":212736624,"uuid":"729383340","full_name":"rektdeckard/hues","owner":"rektdeckard","description":"A Rust client for the Philips Hue API v2","archived":false,"fork":false,"pushed_at":"2025-02-09T03:38:43.000Z","size":172,"stargazers_count":2,"open_issues_count":5,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-24T20:38:14.912Z","etag":null,"topics":["home-assistant","home-automation","iot","lightning","philips-hue","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/rektdeckard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["rektdeckard"]}},"created_at":"2023-12-09T04:07:14.000Z","updated_at":"2025-02-09T03:38:47.000Z","dependencies_parsed_at":"2023-12-15T23:51:39.346Z","dependency_job_id":"ce236188-c9cc-41d7-8502-4b1757aa7756","html_url":"https://github.com/rektdeckard/hues","commit_stats":{"total_commits":25,"total_committers":1,"mean_commits":25.0,"dds":0.0,"last_synced_commit":"449456f33f0c79270d281e3764a0f2867392c191"},"previous_names":["rektdeckard/hues"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rektdeckard%2Fhues","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rektdeckard%2Fhues/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rektdeckard%2Fhues/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rektdeckard%2Fhues/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rektdeckard","download_url":"https://codeload.github.com/rektdeckard/hues/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166857,"owners_count":21058481,"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","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":["home-assistant","home-automation","iot","lightning","philips-hue","rust"],"created_at":"2024-09-24T14:10:40.327Z","updated_at":"2025-04-10T23:50:43.343Z","avatar_url":"https://github.com/rektdeckard.png","language":"Rust","readme":"# hues\n\nA Rust client for the Philips Hue API v2, with a focus on accuracy to the [official spec](https://developers.meethue.com/develop/hue-api-v2/).\n\n[![Crates.io (version)](https://img.shields.io/crates/v/hues.svg?style=flat-square)](https://crates.io/crates/hues)\n\n[![GitHub stars](https://img.shields.io/github/stars/rektdeckard/hues?style=flat-square\u0026label=Star)](https://github.com/rektdeckard/hues)\n[![GitHub forks](https://img.shields.io/github/forks/rektdeckard/hues?style=flat-square\u0026label=Fork)](https://github.com/rektdeckard/hues/fork)\n[![GitHub watchers](https://img.shields.io/github/watchers/rektdeckard/hues?style=flat-square\u0026label=Watch)](https://github.com/rektdeckard/hues)\n[![Follow on GitHub](https://img.shields.io/github/followers/rektdeckard?style=flat-square\u0026label=Follow)](https://github.com/rektdeckard)\n\n`hues` uses [reqwest](https://docs.rs/reqwest/0.11) and the [tokio](https://docs.rs/tokio/1) async runtime. It currently supports most basic operations, such as:\n\n- Local network device discovery\n  - Via **mDNS** using the [mdns](https://docs.rs/mdns/3) crate, requires the `mdns` feature\n  - Via **HTTPS** using the Hue Discovery Endpoint\n- App key creation\n- Light, Group, and Scene control\n- Schedule and Smart Scene management\n\nIt does not yet support the following features:\n\n - [Entertainment API](https://developers.meethue.com/develop/hue-entertainment/) for fast, synchronous light effects via UDP\n- Advanced features regarding Entertainment Configurations\n\n\n\u003e [!WARNING]\n\u003e This is an experimental library, and is subject to change. Use at your own risk. \n\n## Installation\n\n```bash\ncargo add hues\n```\n\n## Usage\n\n\nIf you already know your Bridge IP address and have previously created an\nApp Key, constructing a client is quick and simple:\n\n```rust\nuse hues::prelude::*;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), HueAPIError\u003e {\n    // Construct a Bridge when IP and App Key are known\n    let bridge = Bridge::new([10u8, 0, 0, 123], \"my-app-key\");\n    // Refresh it to fetch the current state of all resources\n    bridge.refresh().await?;\n    \n    // Toggle the power state of a Room named \"office\", if it exists\n    if let Some(office) = bridge.rooms().iter().find(|r| r.name() == \"office\") {\n        office.toggle().await?;\n    }\n    Ok(())\n}\n```\n\n### Bridge discovery and registration\n\nWhen the Bridge IP address is not known, you can locate the device on the\nlocal network using the [Bridge::discover](service::Bridge::discover)\nassociated function. If you are creating an app for the first time, the\n[Bridge::create_app](service::Bridge::create_app) method initializes new\ncredentials that can be used for future authentication.\n\n```rust\nuse hues::prelude::*\nuse std::time::Duration;\n\n#[tokio::main]\nasync fn main() {\n    // Discover a Hue Bridge on the local network, and initialize polling\n    // to synchronize state every 30 seconds.\n    let mut bridge = Bridge::discover()\n        .await\n        .unwrap()\n        .build()\n        .poll(Duration::from_secs(30))\n        .await;\n    // This is your App Key, it should be saved for future sessions\n    // NOTE: press the `Link Button` on the Hues Bridge before attempting\n    // to create new app credentials.\n    let key = bridge.create_app(\"my_app\", \"my_instance\").await.unwrap();\n\n    // Blink each light to confirm you're registered!\n    for light in bridge.lights() {\n        let _ = light.identify().await;\n    }\n}\n```\n\n### Automatic sync with `sse`\n\nOptionally, you can sync automatically by listening for Server-Sent Events. The bridge will communicate changes as they happen to the client, and you can take action if you choose to do so:\n\n```rust\nuse hues::prelude::*;\n\n#[tokio::main]\nasync main() -\u003e Result\u003c(), HueAPIError\u003e {\n    let bridge = Bridge::new([10u8, 0, 0, 123], \"my_app_key\").listen(|_rids| {\n        // Do something whenever changes are sent from the Bridge\n    });\n}\n```\n\n## License\n\nMIT © [Tobias Fried](https://github.com/rektdeckard)\n\n","funding_links":["https://github.com/sponsors/rektdeckard"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frektdeckard%2Fhues","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frektdeckard%2Fhues","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frektdeckard%2Fhues/lists"}