Skip to content

Bibo-Joshi/led-strip-controller

Repository files navigation

LED-Strip Controller

pre-commit.ci status

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).

Main features

  • Allows to control either RGB or RGBWW strips.

  • Provides a restful API

  • GUI available

    Click to view preview

    Demo

  • Strong focus on setting alarms to wake up with the light going on slowly

Limitations:

  • Currently, only designed to set all LEDs to the same color.
  • Adding, deleting & editing the alarm through the GUI is work in progress

Extending

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 the pickle module is available.
  • BaseEffect: Interface class for providing pre-defined sequences of colors. Currently, only AlarmEffect is available for the light alarm.
  • BaseBridge: Interface class for communicating with the LED strip. A bridge based on the RPI.GPIO module is available. If RPI.GPIO is not installed, the current fallback is MuteBridge which just does nothing.

Used Tools & Some Comments

This project uses the following tools/languages/packages:

  • Python for the backend, specifically
  • for the frontend
    • Jinja2 templating
    • (Mostly) Vanilla JavaScript
    • Vanilla CSS
    • Vanilla HTML
    • iro.js for the color pickers

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 😉.

Used resources

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.

Scope, Support, Stability & Contributing

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published