tomasz.codes

Home automation as my dream

published 19.02.20225 min to read
home automation logo

A small idea and dream

Automation is a very general term and has moved forward in all sectors. When I was a kid, cell phones were just slowly starting, and electronics weren't everywhere. People still met normally and filtered their hates at most in the pub over a beer. As i grew up, there were new things coming out and I had a lot of fun taking everything apart. At first, I often failed to put it back together, but sometimes in my teens I put together primitive Hi-Fi that worked!

Primitive because the amplifier was used from a disassembled PC speaker. I connected two speakers to it with wires and added a glowing fan from the PC as cooling. At that time, I didn't use solder and I just twisted the wires together and wrapped them with insulating tape. For the way I did it, it still holds up today (15 years). They have also survived reconstruction when I used them on a construction site.

In that spirit of taking things apart and putting them back together, it went on and overlapped with web and app programming. For everything I did for work or in my spare time I had "futuristic" ideas of what I wanted to program, automate, and create. For example, these were ideas like:

  • smart mirror
  • programming IDE in virtual reality
  • creating a game to learn programming (I still want to)
  • mobile apps to control your home
  • auto-generated backend with API and UI
  • and a billion other things...

At that time, my skill, available technology, and finances did not allow me to realize almost anything. As I look back on it now, I've been learning and improving nonstop for the last 15 years (the learning will probably never stop, the improving won't either :), until I've reached a point where some ideas have become easier, more accessible and some I've even partially implemented.

Why all of this anyway?

I decided to start a blog, because I have too much in my head and I need to organize my thoughts. I also think that the information/tips I'm going to share can be quite useful and save a lot of time and mistakes for other people who are dealing with the same thing. I will be describing what I used automation for and how I put everything together.

I started playing with the idea of automating the whole house in 2017/2018, when the first experiments and projects have started. The first one was called: "BHE" (Best home ever).

BHE application v1 dashboard

BHE v1 beginnings

BHE was the first glimpse of headless CMS, but I didn't even know that such a concept exists. It was (yes past tense, v1 is already deprecated) and application built on Node.js with frontend in React. The advantage and time saving were that only configs and database models ($ Sequelize$ ) for modules were written and the whole admin was generated automatically. A module is a single section, e.g. Articles, Routes, User Rights, etc. If I added the config for the form to the folder, the forms for adding and editing were also generated. This way I was able to build the entire admin including the API in low tens of hours (depending on the size).

BHE v1 list
BHE v1 form

I liked it so much that we started using it at work even though the first idea was for home automation. It didn't look pretty, but it served its purpose. We worked on creating a mobile app and had the API ready right away. Over time, I created libraries that contained reusable modules so that they didn't have to be copied, and so when we initialized the project, we immediately had users, rights, logs, etc. sorted out.

BHE v2 and everything around it

After the first version, I tried several mobile apps and prepared different looks for controlling lights, buttons, and temperature display, but they all remained unfinished. There was always something more important. I wrote the apps in React Native and tried several UI libraries, often finding something missing in them.

As time went on, I programmed various libraries until I got the BHE remake, because a few things bothered me. The module system remained, but I redesigned the architecture. I separated the admin (UI part) and the API, redesigned the UI, and used $ Microsoft's Fluent UI$ . It was still pretty much unpolished, and some components written in a way that I would be ashamed of. But all together it looked nice, and I could build something on it.

BHE v2 navigation
BHE v2 list
BHE v2 form

Many things have been improved, forms can be split into different grids by config, module loading is possible from X libraries and more. We are currently deploying everything on Kubernetes, so it is easy to scale the API to multiple pods and working with the whole "framework" is easier.

At last, automation

In between all that programming, we finally finished the reconstruction and moved into the family house, and I was able to really start applying what I had been trying out on prototypes, paper, and in my head for the last few years. This is a topic I want to elaborate more on in this part of the blog, so I'll just tease with an actual dashboard.

current version of automation dashboard