Skip to content

dimsumlabs/dsl-ledwidget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSL Lights

Control all DSL LED strips from one webpage.

Configure controller endpoints

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.

Deploy

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.

Development workflow

  1. Install the Python dependencies, e.g. pip install -r requirements.txt.
  2. (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.
  3. (For real LEDs) Start the proxy server: flask --app light_proxy run --host localhost --port 8080
  4. Open http://localhost:8080/index.html in the browser.

Testing

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 lobby1

Endpoints provided for a controller named controller-1:

  • GET /controller-1/rgb → plain text body with r, g, b, w on separate lines
  • POST /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.

About

DSL LED control dashboard

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors