Programming Update May-July 2022

I started working my way back towards spending more time programming as the summer started (in between getting re-addicted to CDProjektRed’s Gwent). 

I started off by working on my btrfs snapshot program, Snap in Time. I finally added in the ability for the remote culling to take place. (My backup directories had started getting a LITTLE too big) I also added in official text log files so that I wouldn’t have to rely on my cronjob log file hack. 

After that, still being in the mood to work on logging tasks, I worked on adding a log output window to my ElDonationTracker project. 

Then Michael Kennedy of Python Bytes and Talk Python introduced me to some new concepts. Via the former, I learned about pre-commit and started working on incorporating it into my Python projects. And from the latter, I took his class Modern APIs with FastAPI. It’s a very fast class that, nonetheless, introduced me to a bunch of things I needed to change in my Civ VI Webhook project to make it more maintainable and “professional”. I also learned a bit monre about the power of Pydantic.

In June I started debugging the Adafruit Magtag weather project. I’d followed this tutorial when I got it as part of an Adabox. I don’t know if they’ve updated it, but a key reason why this project is so useful is based on the fact that eink does not require power to maintain the image. So it refreshes once a day to grab the weather. The problem is that sometimes it would fail to reach the web page and then it would crash and not go back to sleep, draining the battery. So I modified the code to use a try/except block and to go to sleep for a while if it can’t reach the website. Ever since doing that, it’s been going for weeks without issues.

A June update to Home Assistant changed the way they were working with MQTT, so I had to modify how that was set up on the server. As part of that, I learned that to get my temp boards to have unique IDs and send JSON, I had to send a config message. An example of the edits are in the current commit for my EnviroPy in the bathroom.

My Magtag issue got me thinking about how I’d sometimes end up with the FunHouse board disconnected from the WLAN and then it wouldn’t attempt to reconnect. After a bit of help from the Adafruit Discord (awesome folks in there!) I was able to code up a solution to check the board’s connection status and attempt a reconnect if it wasn’t connected.

I got the bug to try some Advent of Code, so I did 2015 Day 9 in Python.

Finally, I updated ELDonationTracker with the latest Donor Drive Endpoints and a refusal from GitHub CI to do my Windows build. I still have some work to do here because there’s a weird pip dependency issue happening between ELDonationTracker and my DonorDrivePython packages.

In July, I suddenly decided to see if Adafruit had designed a Stemma QT version of the temperature board I was using for my BBQ Thermostat project or had obtained the newer version, which was supposed to be less buggy. I discovered a way to change the frequency on the bus and FINALLY get it to all work on CircuitPython. I can finally start working on this project again.

After being unable to access some of my services because my Dreamhost DNS program failed, I changed to use the code from ipify to get the IP Address. It’s much less of a hack-job. Unfortunately, I couldn’t use the Python package because it doesn’t work with the latest Python and the author seems to have abandoned the project. There are lots of pull requests just sitting there. I also made the program exit if it can’t get a new IP address rather than hitting the Dreamhost API with nonsense values.
I finally found the time to work on my Civ VI Webhook code and do some of the FastAPI updates I learned about back in May. This did mean I had to refresh my memory a bit on how to make these changes, but I was happy to make things a bit more “correct” in my code. I ended up not only making the code nicer, I also created a nice UI that can be used to “complete” a game. Using for CSS and HTMX for AJAX, I even made it responsive!