Below you will find pages that utilize the taxonomy term “Pi Garage”
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.
Material 3 Flutter 3.16.0 Broke Pi Garage Theme
What happened?
The release of Flutter 3.16.0 introduced something that caught me out and broke the theme in the Pi Garage companion mobile app.
lthough Material 3 has been “opt in” for quite a while (I couldn’t find since when) it is only in 3.16.0 breaking changes you can see that this version has flipped the default value for the flag (useMaterial3) from false to true.
In the Pi Garage mobile app I did not set this flag to false when it was introduced as well as I didn’t lock the version of Flutter in the GitHub action that built and deployed the Android and iOS apps.
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”.
Pi Garage V1.8.0
Pi Garage version 1.8.0 has been released. In this version the mobile app has been given the ability to have multiple configurations saved.
The main driver for this was so that other people who had a Pi Garage could simply give you the configuration details and you could add this as a second (or even tenth). Before this you would have to destructively edit your existing configuration which would be a pain if you had a complex API key.
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.
Pi Garage Mobile App
Along with the backend part of Pi Garage I really wanted to have a mobile app (both iOS and Android) so that it would be easy for users to use Pi Garage without having to configure a 3rd party app (like Home Assistant) or via an API page (like Swagger).
I have had experience with React Native and found the experience akin to fingernails on chalkboard. I wanted to use something that had a better developer (and maintainer) experience.
Pi Garage Deployment
The next decision to make was how to deploy the backend application. I had many different ways that I could release the application. However there were some key considerations to make.
- Ease of deployment (especially for target audience)
- Versioned releases
- Ease of rollback?
This lead me to consider the following.
NPM Package
As the backend is built in Node.JS it would be easy to just push the built packages to npm. Although this would get versioning and rollback I thought that this would be a pretty 💩 experience to deploy and run it.
Pi Garage Backend App Framework
As I had chosen to use a Raspberry Pi for the hardware this allows me to use any language and framework that I want as long as the Raspberry Pi supports it. To view the current Open Source code can see it here on GitHub.
I new that I wanted to write the app in Node.JS (my favourite) and to make my life easier I commonly use the application framework NestJS. This opinionated framework which is heavily inspired by Angular and it’s structure (and cli) allows you to build all sorts of applications quickly and easily.
Pi Garage Interface Board
For interfacing with the garage door I knew (from my one) that there was the ability to add a wired push switch to the garage door to “toggle” it. However I had no idea what voltage/current this used as it was not listed in the manual. I also knew that other garage doors would potentially have varying specifications regarding this. This meant I needed to find someway of using a relay with the Raspberry Pi instead of just using the GPIO straight to the garage door (in case of blowing up the Raspberry Pi).
Pi Garage Base Hardware
For the hardware I made it my mission to use as much common off the shelf components as I could that had a long supply life.
I recall an Open Source touch rotary switch that had a small LCD screen in the centre of it. I thought it looked like something that Tony Stark would have built. However there was one part (a major part at that) that was bought of Alibaba or something, I think it was the motor. This part was “off the back of a truck” so you couldn’t buy a replacement and other people couldn’t make one as well.