Post

QuackDE

The Quackings Dorm Environment

QuackDE

Check out the repository on Github!

Introduction

I started this project back in June, when I had nothing better to do over the summer. I knew I wanted to put up strip LEDs in my room, and wanted a unique way to control them.

Poor design choices

At first, the whole project was written in python. Initially, I was not looking to spend lots of time on the graphics, and I figured the TKinter library would be fine for this application. This was okay, except for the fact that I also wrote all of the LED code in python as well. This was very problematic as the arthimetic needed for some of the heavier themes was too slow using the python interpreter. It would cause the graphics to lag, since both the graphics and LED code were running on a single core. My first few attempts to fix this problem using multithreading and multiprocessing failed due to the constraints of Python’s global interpreter lock (GIL) and being unable to pickle some objects.

Language Split

I figured that the LEDs could be ran separate from the graphics, so I created a socket in C++ and had the LED code run on a thread. This was much better, as the compiled code was much faster and simpler than the python code, and didn’t lag the graphics at all.

HTTP API

We needed to integrate homeassistant with the LED project. The easiest way was to create a REST API with a few POST endpoints.

This post is licensed under CC BY 4.0 by the author.