{"id":20646706,"url":"https://github.com/cbartram/stream-lights","last_synced_at":"2025-07-17T01:34:17.408Z","repository":{"id":69898145,"uuid":"336342991","full_name":"cbartram/Stream-Lights","owner":"cbartram","description":"Trigger Philips Hue lights when an event occurs on your Twitch stream","archived":false,"fork":false,"pushed_at":"2021-03-01T01:17:44.000Z","size":109,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T17:31:56.563Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/cbartram.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2021-02-05T17:32:56.000Z","updated_at":"2021-03-01T01:17:46.000Z","dependencies_parsed_at":"2023-03-02T10:30:36.933Z","dependency_job_id":null,"html_url":"https://github.com/cbartram/Stream-Lights","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cbartram/Stream-Lights","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbartram%2FStream-Lights","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbartram%2FStream-Lights/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbartram%2FStream-Lights/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbartram%2FStream-Lights/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cbartram","download_url":"https://codeload.github.com/cbartram/Stream-Lights/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbartram%2FStream-Lights/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265558651,"owners_count":23787952,"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":[],"created_at":"2024-11-16T16:26:51.587Z","updated_at":"2025-07-17T01:34:17.390Z","avatar_url":"https://github.com/cbartram.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://i.imgur.com/bADycH9.png\" alt=\"lightbulb logo\" /\u003e\n\u003c/p\u003e\n\n# Stream Lights\n\nThis is a java based software package which can trigger Philips Hue lights when an event occurs on your Twitch stream.\n\n## Getting Started\n\nTo get started using this software package there are a few simple steps:\n\n- Gather the required access tokens, keys, and credentials to access the Twitch and Philips hue API's (we will walk you through this!)\n- Start the server (in this software package) and create some subscriptions to your (or who ever's) Twitch account\n- Configure your lights to take certain actions when a new event is received\n\n## Prerequisites\n\nThis section outlines the process of gathering the required tokens, keys, and credentials to use this software. Its broken\ndown into two sections: Twitch Setup and Philips Hue Setup.\n\n#### Twitch Setup \nIn order to run the server and connect to Twitch you will need some credentials.\n\nCreate a new [Twitch developer App here](https://dev.twitch.tv/console/apps/create) with the following properties:\n\n| Name               | OAuth Redirect URL | Category     |\n|--------------------|--------------------|--------------|\n| Any name you want! | http://localhost   | Any category |\n\n![image twitch app creation](https://i.imgur.com/UvFMKLn.png)\n\nOnce your app is created make sure you copy your Client Id and generate (and copy) a new Client Secret. You will need\nto keep these safe and in a private place (Stream lights will need this later).\n\n![image twitch app registration](https://i.imgur.com/pL6PfSR.png)\n\n#### Philips Hue Setup\n\nThis software requires that you have a registered token with your Philips Hue Bridge.\nPhilips Hue has [excellent documentation here](https://developers.meethue.com/develop/get-started-2/) which will walk you through this process.\n\nAn example token looks like this: `1028d66426293e821ecfd9ef1a0731df`.\n\nTo summarize the Philips Hue documentation you need to:\n\n- Discover the IP address of your Hue Bridge at [Hue Discovery](https://discovery.meethue.com/)\n- Go to the CLIP configuration panel in a Web Browser (Google Chrome) within your Bridge at http://\u003cYOUR_BRIDGE_IP\u003e/debug/clip.html\n- Put `/api` in the URL box and `{\"devicetype\":\"stream_lights#stream_server\"}`\n- Click the button on the top of your Hue\n- Sprint back to your computer!!\n- Click the \"Post\" button in the CLIP configuration panel\n- Copy the randomly generated username from the Command Response field.\n\n![hue_setup](https://i.imgur.com/2lo5MMQ.png)\n\n### Installing\n\nTo install this software you can either download the latest jar from the [releases](https://github.com/cbartram/Stream-Lights/releases) section or clone this repository with\n\n```shell\n$ git clone https://github.com/cbartram/Stream-Lights.git\n```\n\nand build the jar file locally using [Maven](https://maven.apache.org).\n\n```shell\n$ mvn clean package\n```\n\n### Running\n\nTo run the server you should have [Java](https://www.java.com/en/download/) installed on your local machine. This software is packaged\ninto a runnable Java archive which exposes a webserver on your local machine. You can run the server using:\n\n```shell\n$ export TWITCH_CLIENT_ID=\u003cYour twitch client id from previous step\u003e\n$ export TWITCH_CLIENT_SECRET=\u003cYour twitch client secret from previous step\u003e\n$ java -jar /path/to/the/StreamLights-0.0.1-SNAPSHOT.jar\n```\n\nThe server will be running on your local machine at `http://localhost:8080` we recommend installing [ngrok](https://ngrok.com/) to expose \nthis server to the internet through an HTTPS domain. Having an https domain is required to register a callback function for Twitch integration. \n\nTo use [ngrok](https://ngrok.com/) simply follow its documentation to download the executable file and run: \n\n```shell\n$ ngrok 8080\n```\n\nYou should see output which looks like this:\n\n```shell\nSession Status                online\nAccount                       Your Account (Plan: Free)\nVersion                       2.3.35\nRegion                        United States (us)\nWeb Interface                 http://127.0.0.1:4040\nForwarding                    http://5c69b7.ngrok.io -\u003e http://localhost:8080\nForwarding                    https://5c69b7.ngrok.io -\u003e http://localhost:8080\n\nConnections                   ttl     opn     rt1     rt5     p50     p90\n                              91      0       0.00    0.00    0.01    60.23\n\nHTTP Requests\n-------------\n```\n\nGrab the `Forwarding` https address to use for your callback URL in the subscription registration payload. You can test\nthat everything is setup correctly by using the following shell command:\n\n```shell\ncurl -X GET http://localhost:8080/actuator/health \n# {\n#  \"status\": \"UP\"\n# }\n```\n\nIf you used `ngrok` then make sure to check your `ngrok` Forwarding URL with the `curl` command!\n\n### Creating a Subscription\n\nYou can create a subscription through the `ngrok` endpoint or your `localhost`. Creating a subscription will let you hook into\nmany different types of Twitch events to trigger your Philips hue lights.\n\nPlease reference the [Twitch Documentation](https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types) for a list of viable events to which \nyou can subscribe.\n\nCreating a subscription can be done with the following Curl request:\n\n```shell\ncurl --location --request POST 'http://localhost:8080/twitch/subscription' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"type\": \"channel.follow\",\n    \"condition\": {\n        \"username\": \"runewraith_\"\n    },\n    \"transport\": {\n        \"callback\": \"https://5c679b7.ngrok.io/twitch/subscription/webhook\"\n    }\n}'\n```\n\nTake note that this request is essentially saying \"Notify my Philips hue lights anytime the user: runewraith_ on Twitch get a new follower to his/her channel.\"\nYour transport callback **must use HTTPS** therefore it should be set to your `ngrok` forwarding URL. \n\nSome other common events you may want to subscribe to include: \n\n- `channel.subscribe`\n- `channel.cheer`\n- `channel.hype_train.begin`\n- `channel.hype_train.progress`\n- `channel.hype_train.end`\n- `stream.online`\n\n### Listing Subscriptions\n\nYou can list all your current subscriptions with the following curl: \n\n```shell\ncurl --location --request GET 'http://localhost:8080/twitch/subscription' \\\n--header 'Content-Type: application/json'\n```\n\nIt will return a response which looks like the following:\n\n```json\n{\n    \"total\": 1,\n    \"data\": [\n        {\n            \"id\": \"9e5d41-269-402-a96-afacde85b\",\n            \"status\": \"enabled\",\n            \"type\": \"channel.follow\",\n            \"version\": \"1\",\n            \"condition\": {\n                \"broadcaster_user_id\": \"123456\"\n            },\n            \"created_at\": \"2021-02-07T17:38:20.799440479Z\",\n            \"transport\": {\n                \"method\": \"webhook\",\n                \"callback\": \"https://5c6759b7.ngrok.io/twitch/subscription/webhook\"\n            }\n        }\n    ],\n    \"limit\": 10000,\n    \"pagination\": {}\n}\n```\n\n### Removing an existing Subscription\n\nYou can remove an existing subscription as long as you have the subscription id. The subscription id is a long string \nwhich will look something like this: `\"9e5d41-269-402-a96-afacde85b\"`. Your subscription id is returned in the response\nwhen you create a new subscription.\n\nThe following curl will delete a subscription ID called `\u003cSUBSCRIPTION_ID_HERE\u003e`\n\n```shell\ncurl --location --request DELETE 'http://localhost:8080/twitch/subscription/\u003cSUBSCRIPTION_ID_HERE\u003e' \\\n--header 'Content-Type: application/json'\n```\n\nThe response will not contain a body but will have a 200 status code.\n\n## Running the tests\n\nTests are written and run with JUnit and Mockito. To run the tests simply use [Maven](https://maven.apache.org):\n\n```shell\n$ mvn clean test\n```\n\n## Deployment\n\nDeployment section coming soon! \n\n## Built With\n\n* [Spring](http://spring.io/) - The web framework used\n* [Maven](https://maven.apache.org/) - Dependency Management and build system\n* [Java](https://java.com) - Programming Language\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/cbartram/Stream-Lights/tags).\n\n## Authors\n\n* **Christian Bartram** - *Initial work* - [Cbartram](https://github.com/cbartram)\n\nSee also the list of [contributors](https://github.com/cbartram/Stream-Lights/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\n## Acknowledgments\n\n* Twitch for making a simple and safe API\n* Philips hue for making some fun hackable lights!\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbartram%2Fstream-lights","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcbartram%2Fstream-lights","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbartram%2Fstream-lights/lists"}