This repository provides a controller for RGB+Warm-White LED strips, tailored to my needs. Simultaneously, I used it to try out some things that I haven't worked with before (more on that below).
-
Allows to control either RGB or RGBWW strips.
-
Provides a restful API
-
GUI available
-
Strong focus on setting alarms to wake up with the light going on slowly
- Currently, only designed to set all LEDs to the same color.
- Adding, deleting & editing the alarm through the GUI is work in progress
I've tried to make sure that the structure is easy to adapt to different use cases. The following interface classes allow implementing custom functionality.
BasePersistence
: Interface class for persisting color values & alarms across restarts. Currently, an implementation via thepickle
module is available.BaseEffect
: Interface class for providing pre-defined sequences of colors. Currently, onlyAlarmEffect
is available for the light alarm.BaseBridge
: Interface class for communicating with the LED strip. A bridge based on theRPI.GPIO
module is available. IfRPI.GPIO
is not installed, the current fallback isMuteBridge
which just does nothing.
This project uses the following tools/languages/packages:
- Python for the backend, specifically
- starlette for hosting the GUI
- fastapi for the API
- APScheduler for scheduling the alarms
- RPi.GPIO for an implementation of
BaseBridge
- for the frontend
I'm rather comfortable with Python and have already used APScheduler
to some extent.
I've also played around with the others a bit, but not as much as in this project.
Specifically I have little experience with web development, which is why I wanted to try around a bit with vanilla HTML, JS & CSS instead of diving into Vue/Angular/React.
As such, code & code structure are probably gruesome to look at for everyone who has some idea of it.
I warned you 😉.
As mentioned above, I don't have much experience with web development. So it should come at no surprise that I borrowed heavily from existing resources. This projects uses code from
- This pen for the fixed color picker (Copyright included in the corresponding file)
- This pen for integrating
iro.js
into the GUI (Copyright included in the corresponding file) - This pen for the on-off toggles for the alarms (Copyright included in the corresponding file)
- This pen for the big on-off toggle (Copyright included in the corresponding file)
- Mono icons for some icons (MIT License)
and draws inspiration from the iro.js
website for the overall layout of the GUI.
I consider this mostly a private project for my personal usage (and education). As such, I won't put particular effort in maintaining a stability policy. I will also most likely not accept feature requests (until I like them myself) or offer support. If you coded some extension of or fix for this project you're however welcome to send a pull request.