{"id":18100111,"url":"https://github.com/enwi/hueplusplus","last_synced_at":"2025-04-08T03:10:02.188Z","repository":{"id":18557336,"uuid":"80045624","full_name":"enwi/hueplusplus","owner":"enwi","description":"A simple C++ library to control Philips Hue lights on Linux, MacOS, Windows, Espressif ESP32 SDK and Arduino. Full documentation at","archived":false,"fork":false,"pushed_at":"2025-02-13T07:03:33.000Z","size":27805,"stargazers_count":56,"open_issues_count":1,"forks_count":22,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-31T17:21:19.621Z","etag":null,"topics":["arduino","c-plus-plus","cpp","esp32","hacktoberfest","hue","hue-bridge","hue-lights","lights","linux","macos","philips","philips-hue","philips-hue-bridge","philips-hue-lights","windows"],"latest_commit_sha":null,"homepage":"https://enwi.github.io/hueplusplus/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enwi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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":["enwi"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-01-25T18:48:15.000Z","updated_at":"2025-02-28T13:21:34.000Z","dependencies_parsed_at":"2024-10-31T21:13:21.835Z","dependency_job_id":"c76486e2-dfe3-4b76-a83e-d457903499ac","html_url":"https://github.com/enwi/hueplusplus","commit_stats":{"total_commits":341,"total_committers":6,"mean_commits":"56.833333333333336","dds":0.5043988269794721,"last_synced_commit":"06ec4330d9dc943946dc90e8512bb0e7eec7f571"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enwi%2Fhueplusplus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enwi%2Fhueplusplus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enwi%2Fhueplusplus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enwi%2Fhueplusplus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enwi","download_url":"https://codeload.github.com/enwi/hueplusplus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767236,"owners_count":20992548,"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":["arduino","c-plus-plus","cpp","esp32","hacktoberfest","hue","hue-bridge","hue-lights","lights","linux","macos","philips","philips-hue","philips-hue-bridge","philips-hue-lights","windows"],"created_at":"2024-10-31T21:13:02.939Z","updated_at":"2025-04-08T03:10:02.146Z","avatar_url":"https://github.com/enwi.png","language":"C++","readme":"# hueplusplus\nA simple and easy to use library for Philips Hue Lights\n\n| Branch | CI | Codecov | LGTM\n|:-|:-|:-|:-|\n| [Master](https://github.com/enwi/hueplusplus/tree/master) | [![CI](https://github.com/enwi/hueplusplus/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/enwi/hueplusplus/actions/workflows/build.yml)| [![codecov](https://codecov.io/gh/enwi/hueplusplus/branch/master/graph/badge.svg)](https://codecov.io/gh/enwi/hueplusplus) | [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/enwi/hueplusplus.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/enwi/hueplusplus/context:cpp) |\n| [Development](https://github.com/enwi/hueplusplus/tree/development) | [![CI](https://github.com/enwi/hueplusplus/actions/workflows/build.yml/badge.svg?branch=development)](https://github.com/enwi/hueplusplus/actions/workflows/build.yml) | [![codecov](https://codecov.io/gh/enwi/hueplusplus/branch/development/graph/badge.svg)](https://codecov.io/gh/enwi/hueplusplus) | |\n\n## Features\n* find bridges with SSDP or set an ip manually\n* all common light functions (brightness, color, temperature)\n* extended alert() functions, which alert in a specific color (good for notifications)\n* supports sensors, rules, groups, scenes and schedules\n* streaming with entertainment mode\n* [documented with doxygen](https://enwi.github.io/hueplusplus/)\n* tested with google test, google mock and gcov/lcov\n\n## Compatibility\n* Linux\n* Windows\n* MacOS\n* Espressif ESP32 SDK \u0026 Arduino\n\n## How to use\n### \u003ca name=\"searchingBridges\"\u003e\u003c/a\u003eSearching for Bridges\nTo start searching for a Hue Bridge you will need to choose an IHttpHandler and create one. The options are a \"WinHttpHandler\" (for windows) or a \"LinHttpHandler\" (for linux).\nThen create a BridgeFinder object with the handler.\nThe handler is needed, because it tells the finder which functions to use to communicate with a bridge or your local network.\nAfter that you can call findBridges(), which will return a vector containing the ip and mac address of all found Bridges.\n```C++\n// For windows use std::make_shared\u003chueplusplus::WinHttpHandler\u003e();\nhandler = std::make_shared\u003chueplusplus::LinHttpHandler\u003e();\nhueplusplus::BridgeFinder finder(handler);\nstd::vector\u003chueplusplus::BridgeFinder::BridgeIdentification\u003e bridges = finder.findBridges();\nif (bridges.empty())\n{\n\tstd::cerr \u003c\u003c \"No bridges found\\n\";\n\treturn;\n}\n\n```\n\n### Authenticate Bridges\nIf you have found the Bridge you were looking for, you can then move on with the authentication process.\nTo get a new username from the Bridge (for now) you simply call getBridge(bridges[\\\u003cindex\\\u003e]),\nwhere index is your preferred Bridge from the part [Searching for Bridges](#searchingBridges).\n```C++\nhueplusplus::Bridge bridge = finder.getBridge(bridges[0]);\n```\nIf you on the other hand already have a username you can add your bridge like so\n```C++\nfinder.addUsername(bridges[0].mac, \"\u003cusername\u003e\");\nhueplusplus::Bridge bridge = finder.getBridge(bridges[0]);\n```\nIf you do not want to use the BridgeFinder or you already know the ip and username of your bridge you have the option to create your own Bridge object.\nHere you will need to provide the ip address, the port number, a username and an HttpHandler\n```C++\n// For windows use std::make_shared\u003chueplusplus::WinHttpHandler\u003e();\nhandler = std::make_shared\u003chueplusplus::LinHttpHandler\u003e();\nhueplusplus::Bridge bridge(\"192.168.2.102\", 80, \"\u003cusername\u003e\", handler);\n```\n\n### Controlling lights\nIf you have your Bridge all set up, you can now control its lights.\nFor that create a new Light object and call lights().get(\\\u003cid\\\u003e) on your bridge object to get a reference to a specific light, where id\nis the id of the light set internally by the Hue Bridge.\n```C++\nhueplusplus::Light light1 = bridge.lights().get(1);\n```\nIf you don't know the id of a specific light or want to get an overview over all lights that are controlled by your bridge, \nyou can get a vector containing them by calling getAll(). If no lights are found the vector will be empty.\n```C++\nstd::vector\u003chueplusplus::Light\u003e lights = bridge.lights().getAll();\n```\nIf you now want to control a light, call a specific function of it.\n```C++\nlight1.on();\nlight1.setBrightness(120);\nlight1.alertHueSaturation(25500, 255);\nlight1.setColorLoop(true);\nlight1.setColorRGB(255, 128, 0);\nlights[1].off();\nlights.at(1).setColorHue(4562);\n```\nBut keep in mind that some light types do not have all functions available. So you might call a\nspecific function, but nothing will happen. For that you might want to check what type\nof a light you are controlling. For that you can call the function getColorType(), which will return\na ColorType.\n```C++\nhueplusplus::ColorType type1 = light1.getColorType();\n```\nThere's also a new way to check whether specific functions of a light are available:\n```C++\nlight1.hasBrightnessControl();\nlight1.hasTemperatureControl();\nlight1.hasColorControl();\n```\nThese will either return true(light has specified function) or false(light lacks specified function).\n\n### Further reading\nIf you want to know more about all functions just look inside the doxygen documentation. It can be found [here](https://enwi.github.io/hueplusplus/)\n\n## Build and install\n### Basic installation\nIf you want to build the library you can use cmake (at least version 3.8). First create a build folder and then execute cmake.\n```bash\nmkdir build\ncd build\ncmake ..\n```\nThen compile the code with make. If you are inpatient use the option -j\\\u003cnumber\\\u003e, where number specifies how many files are compiled at the same time. Note this number should not exceed the number of cores*2 of your machine.\n```bash\nmake\n```\n```bash\nmake -j4\n```\nIf you want to install the library use\n```bash\nmake install\n```\nTo remove it\n```bash\nmake uninstall\n```\n\n### Advanced usage\nIf you have a project that already uses CMake you probably want to add the hueplusplus library directly in your cmake file.\nFor that the best way is to use find_package().\nWhen cmake finds the hueplusplus library you can then link against either the shared or static version of the library.\n```cmake\nfind_package(hueplusplus REQUIRED)\n\ntarget_link_libraries(\u003cexecutable\u003e PUBLIC hueplusplusstatic)\n```\nBut this will only work if the hueplusplus library is already installed.\nTo get around this problem there is a pretty awesome way.\nIf you have the hueplusplus repository included in your project repository (as a submodule) or know where the folder lives you can do the following:\n```cmake\nfind_package(hueplusplus QUIET)\nif(NOT hueplusplus_FOUND)\n    message(STATUS \"-- hueplusplus not found, building it\")\n    add_subdirectory(\"${CMAKE_CURRENT_SOURCE_DIR}/\u003cpath to directory\u003e/hueplusplus\" \"${CMAKE_CURRENT_BINARY_DIR}/hueplusplus\")\nendif()\n\ntarget_link_libraries(\u003cexecutable\u003e PUBLIC hueplusplusstatic)\n```\nThis will check if the hueplusplus library was found by find_package() and if not it will use the specified path to the library source and compile it during the build process.\n\n### Running tests\nIf you additionally want to run the tests use cmake with the option -Dhueplusplus_TESTS=ON. Testing is done with Google gtest and gmock. Note that you wont need to install gtest/gmock yourself, because cmake will automatically download them and include them during the build. Since I added a custom target you will only need to call \"make unittest\" and the tests are compiled and executed.\n```bash\nmkdir build\ncd build\ncmake .. -Dhueplusplus_TESTS=ON\nmake unittest\n```\nIf you also want to execute coverage tests you will need to install gcov and lcov yourself. To run the coverage test use\n```bash\nmake coveragetest\n```\n\n\n## Copyright\nCopyright (c) 2017 Jan Rogall \u0026 Moritz Wirger. See LICENSE for further details.\n","funding_links":["https://github.com/sponsors/enwi"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenwi%2Fhueplusplus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenwi%2Fhueplusplus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenwi%2Fhueplusplus/lists"}