Darkness is a simple dockerized Flask API used to control NeoPixels strips connected to Raspberry Pi.
📚 For more information go to Darkness official site!
The most noticeable features currently implemented in Darkness:
- Run as a Docker container, simple to get started.
- Python API, lightweight Flask powered API.
- Animation System, flexible way to show notifications.
- Command Line client, by using Darkness CLI you can integrate anything.
Darkness is run as a Docker container, you can try it out with commands below.
This runs a container with minimal setup required:
docker run --name darkness --cap-add SYS_RAWIO --device /dev/mem --device /dev/vcio -p 5000:8000 rangerdigital/darkness
🔨 You can specify LED count
-e LED_COUNT=16
, (Default: 16) and GPIO port-e LED_GPIO=18
, Default: 18).
Or in case It doesn't work:
docker run --name darkness --privileged -p 5000:8000 rangerdigital/darkness
🔪 The privileged flag is seriously insecure, I wouldn't trust me if I were you!
You can use Darkness CLI client control Darkness running on your Raspberry Pi by installing it with the command below:
curl https://darkness.bednarski.dev/install.sh | sudo bash
Currently supports only Linux distributions, or If you want to have full control use Darkness API.
The easiest way to start is to run GET requests against /state
endpoint,
with POST or PUT you can update these values to control still ambient light.
{
"hue": 360,
"saturation": 1,
"status": true,
"value": 1
}
If you want to see the rainbow animation just POST or PUT to /animations/rainbow
.
{
"msg": "Rainbow animation completed!"
}
You can specify duration of the animation with URL parameters,
for example: /animations/rainbow?duration=10
will play rainbow animation for 10 seconds.
💡 For full API documentation go to Darkness official site!
You are more than welcome to help me build the Darkness!
Just fork this project from the master
branch and submit a Pull Request (PR) to the dev
branch.
If you are modifying the Darkness server you should also run pytest
functional tests inside /darkness/tests
directory.
This project is licensed under GPL-3.0 .