https://github.com/carlgo11/nanoleaf-github-activity
GitHub Activity graph on Nanoleaf
https://github.com/carlgo11/nanoleaf-github-activity
activity-graph github-activity nanoleaf nanoleaf-canvas
Last synced: 7 months ago
JSON representation
GitHub Activity graph on Nanoleaf
- Host: GitHub
- URL: https://github.com/carlgo11/nanoleaf-github-activity
- Owner: Carlgo11
- License: gpl-3.0
- Created: 2021-03-27T21:20:44.000Z (almost 5 years ago)
- Default Branch: nodejs
- Last Pushed: 2024-04-15T23:01:38.000Z (almost 2 years ago)
- Last Synced: 2024-05-02T04:12:15.064Z (over 1 year ago)
- Topics: activity-graph, github-activity, nanoleaf, nanoleaf-canvas
- Language: JavaScript
- Homepage:
- Size: 85 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Nanoleaf Github Activity 
GitHub Activity graph on Nanoleaf Canvas using the Nanoleaf LAN API.
## Installation
[](https://hub.docker.com/r/carlgo11/nanoleaf-github-activity)
[](https://github.com/Carlgo11/nanoleaf-github-activity/pkgs/container/nanoleaf-github-activity)
### Environment Variables
The project requires the following environment variables to be present.
| Name | Description | Example |
|----------------|----------------------------------------|---------------------|
| GITHUB_USER | GitHub Username | "Carlgo11" |
| NANOLEAF_HOST | LAN IP and port of the Nanoleaf Canvas | "192.168.1.2:16021" |
| NANOLEAF_TOKEN | Nanoleaf [Auth Token](#Auth-Token) | |
### Auth Token
Controlling the Nanoleaf lights requires an "auth token". Follow the instructions below to generate a token.
1. Send a POST request from your computer to the Nanoleaf lights.
```shell
curl -X "POST" http://192.168.1.2:16021/api/v1/new
```
2. Press and hold the power button on the lights for 5-7 seconds.
3. You should now have received a 32 character long "auth token" on your computer. Save this inside your `.env` as `NANOLEAF_TOKEN`
> [!NOTE]
> Replace `192.168.1.2` with the IP address of your Nanoleaf lights.
> The default port is `16021`.
## Usage
The Node.js code is written to be run inside a Docker container. You can either use a Docker Compose file or just run a Docker command to start the container. Running this container will expose a Node.js server on port 3000. Any HTTP connections to this server trigger the code to fetch recent GitHub activities and update the Nanoleaf Canvas accordingly.
> [!NOTE]
> Remember to first populate your `.env`-file with the required data.
### Docker
Run the Docker container using the provided environment variables from the `.env` file.
```shell
docker run --env-file .env --ports 3000:3000 carlgo11/nanoleaf-github-activity
```
### Docker Compose
```yaml
version: '3.8'
services:
nanoleaf:
image: carlgo11/nanoleaf-github-activity
restart: unless-stopped
env_file:
- .env
ports:
- "3000:3000"
```
### Updating the lights
Once you've started the Docker container, you can access the Node.js server on http://localhost:3000. Every time you access this page, the nanoleaf lights will update.
I recommend either setting up a cronjob on your server, or a home automation service such as [Apple Shortcuts](https://support.apple.com/guide/shortcuts/welcome/ios), [Node-RED](https://nodered.org/), [Home Assistant](https://home-assistant.io).
## Festive colors
During certain dates, the default colors change on the Canvas. Should you not want this, you can create a file called `colors.json` with the following data:
```json
{
"default": [
"#EBEDF0",
"#9BE9A8",
"#40C463",
"#30A14e",
"#216E39"
]
}
```
The above-mentioned code will cause the Canvas to always use the same colors for the graph. To add it to your container,
append your `docker-compose.yml` file with the following lines:
```diff
version: '3.8'
services:
nanoleaf:
image: carlgo11/nanoleaf-github-activity
restart: unless-stopped
env_file:
- .env
ports:
- "3000:3000"
+ volumes:
+ - "./colors.json:/app/colors.json"
```
Here's a graphical demonstration of the custom festive colors
### Valentines Day _(February 14th)_

### Halloween _(October 31st)_

### Christmas _(December 24th - 25th)_

## License
The project is licensed under GPLv3. See the full license in [LICENSE.md](LICENSE.md).