Control all DSL LED strips from one webpage.
Update controllers inside app.js with the correct URL for each LED controller. Also add canvas coordinates so that the LED strip will be drawn on the floorplan.
The web frontend talks to the LED controllers directly. However, if those are on separate hostnames, browsers may block the requests due to cross-origin restrictions.
You can use a HTTP server to serve this webpage and the LEDs on the same hostname; the included light_proxy.py script is a basic server that does this.
- Install the Python dependencies, e.g.
pip install -r requirements.txt. - (For mock LEDs) Start the mock server (see below). And serve the web page however you like, e.g.
python3 -m http.server --port 8080. - (For real LEDs) Start the proxy server:
flask --app light_proxy run --host localhost --port 8080 - Open
http://localhost:8080/index.htmlin the browser.
Use the mock server to simulate any number of LED strips. Each controller is served under its own path segment (e.g. /controller-1/rgb).
Make sure to change the controller URLs in app.js (explained above) to the mock URLs.
# 3 controllers with made-up names
python3 mock_controllers.py --port 8081 --controllers lab1 lab2 lobby1Endpoints provided for a controller named controller-1:
GET /controller-1/rgb→ plain text body withr,g,b,won separate linesPOST /controller-1/rgb.lua?r=0&g=0&b=0&w=0→ JSON response{"error":0,"message":"OK"}
Values follow the device quirk where 0 is max brightness and 1023 is off. The mock maintains state per controller so that GET /rgb matches the most recent POST.