Below you will find pages that utilize the taxonomy term “Software Engineering”
Unit Testing
I was pair programming with a friend of mine (who is getting more in depth into programming) on a small project and the subject of tests (as in Unit Tests) came up to try and debug some behaviour. My friend then communicated that they have not written many tests and was a bit unsure of how to get started. To which I very much appreciated their honesty (it’s often not easy).
Npm Broke Arm64 Pi Garage Builds
I know this sounds crazy right? Lets rewind a bit so we can try and understand why.
In a previous post Material 3 + Flutter 3.16.0 Broke Pi Garage Theme I stated that you should pin core dependencies. Apart from the Flutter version there was another place that I did not pin dependencies specifically enough. This was in the Dockerfile. Here I has specified the node version as below.
FROM node:18
As you can see although this would limit the Node version to 18 this would allow anything from 18.0.0 through to 18.100.0. Something very interesting happened with version 18.19.0. In the Release Notes one of the first things mentioned is that npm 10 has been backported and included. This like the Flutter + Material 3 issue linked above caught me by surprise.
Pi Garage V2
It’s been a while since Pi Garage V2 has been released and I have not mentioned it on my socials. Since this is a major release I thought I would go into a bit of detail on to why I decided to make a major release version bump as well as the nitty gritty to what changed.
V1 Problems
Although V1 worked it had a pretty big flaw in my opinion and it was related to how it handled the sequences. To rewind, in Pi Garage a sequence is the actual hardware “actions” that take place when a door is “opened”, “closed” or “toggled”.
Db Migration
Whilst performing the server migration (detailed in some of my previous posts) I had to perform a database migration of a Postgres instance.
5 Million Data Points
This database though not critical is a basic Data Warehouse that is the data storage for a data scraper application. This means that although some down time is acceptable a large window of downtime of the database would result in a large data gap.
Pi Garage Relay Lock Up
After initial release with the Home Assistant mobile app performing the opening and closing it was observed that quick button presses (from my daughter pressing the button rapidly🤣) that this could cause a lock up of the hardware in a weird way.
You could see the lights on the relay change to show that the control signal to change the relay state was working however you could not hear the “click” of the relay. Other relays worked as expected, it was as though the relays themselves or something got “latched” in the changed state.
Open Source Repository Challenges
Making the project Open Source is a good thing as it allows others to learn from it but also to so that people can be assured that there is no nasty other software that is installed with the application.
However as anyone on the internet can view the source code this introduces complexities that you do not have with a private repository.
One main issue is that you cannot store configuration or credentials in the repository. Every configuration item (say an app store identifier) and credential item (Google Play Store publish token or API key) MUST come from repository secrets.
Pi Garage Realtime Communication
Pi Garage worked well for a while, however there was one thing that bugged me. When you would have 2 devices open on the home screen (in the mobile app) and you would open the door on one device the state would change from “closed” to “opening” to “open” but on the other phone it would still say “closed”.
This annoyed me as to get the latest state you constantly had to “swipe to refresh” to ensure that you had the latest state of the garage door. Not a big deal in the scheme of things but it was a good problem to solve.