Control an Adafruit NeoPixel strip through a web UI with support for presets, schedules, and custom animations.
MIT License
Lights allows you to control an Adafruit NeoPixel light strip using a web interface on a Raspberry Pi. Authentication provided by Auth0 prevents unauthorized users from messing with your lights. The frontend acts as a real-time interface synchronized between all connected clients, reducing the possibility of stale data.
Lights is currently controlling a strip in my dorm room. You can see what my lights are doing at https://lights.krantz.dev.
To control the lights, there are 3 primary components: the frontend, the API, and the controller. The frontend, built using React, provides a friendly user interface for viewing and controlling. The API, written in Golang, bridges the controller and frontend to provide higher level control over the strip such as presets and schedules. Finally, the controller, written in Python, does the interfacing with the light strip itself through a handful of basic primitives.
The API and frontend communicate via a REST API and WebSocket API. The REST API is used for CRUD operations on animations, presets, and schedules which are all stored in the database. The WebSocket API is used for providing real-time status updates and control over the strip. There is also a server-sent events route for providing real-time updates to the REST resources.
The API and controller communicate via a Cap'n Proto RPC interface as defined in lights.capnp. For similar systems, the separation between API and controller would not be necessary. However, as the NeoPixel library only runs on the Raspberry Pi, this makes it possible to develop on any system that is on the same network as the Pi.
Some features I would like to add in the future:
If you would like to contribute to fix a bug or add a feature, feel free to make a PR!