Flask as the backend, keep the code to run the lights, keep the frontend js, but do it through templates. This also lets us swap dictionaries easily (instead of a huge list in js)