Skip to main content

The story of a Hack Job

"So, you have hacked it" -- Few days ago one of the guys at work passed me this comment on a random discussion about something I built. I paused for a moment and pondered:
  • Do I reply defending how that's not a hack.
    OR
  • Do I just not bother
I picked the second option for 2 reasons:
  • It was late.
  • It probably isn't worth defending the "hack vs" topic as the comment passed was out of context.
So I chose the next best action and replied "Yep, sure did and it is working great.". I felt like Batman in the moment.
In this post I will rant about the knowledge gap around hacking and then describe about one of the components of my home automation project (really, this is the main reason for this post) and use that as an example how hacking is cool and does not always mean bad.

But first lets align on my definition of hacking:

People use this term in good and bad, both ways. For example:
  • "He/she did a hack job" -- Yeah, that probably means bad. Let's say that an application was built using a certain framework and someone did not take the time to understand the framework first and put/deployed a code to work around it to make it work and in process creating a lot of code convolution and complexity. That's actually a bad hack which creates tech debts. (I am 90% sure we all have done it and/or at least had come across it and condemn it.)
  • "You hacked it" -- well, this one depends. It can mean good when you did something that extends the functionality than what was shipped with OR could be completely taken out of context because of lack of understanding (like my example above).
The main point is, the term Hack or Hacking is really quite contextual.
Also let me make few things clear here:
  • The way they show in movies that's not how hacking works. Hacking simply does not happen by typing on keyboard really fast. It requires a lot of knowledge, study, research and dedication. EG> If one didn't know how security algorithm, protocol, rolling code etc works inside and out, the individual won't be able to hack a damn thing (FYI, ddos is not considered as a hack). So one needs to put a lot of extra time and effort acquiring those skillsets before she/he promotes to be a hacker. 
  • Hacking applications and causing incidents or inconvenience to a lot of people's life, stealing PII etc is not in any way cool. It's a shameful act and waste of talent.
  • Being an Ethical hacker is cool. If you could let the right person know about the exploited vulnerability then that works in the positive way. Hack to improve life, not to make it difficult. 

Now, lets put things in context, shall we.

Scene 1:
Extending functionality using API layer isn't a bad hacking. In fact that's how (in a over simplified way) Microservices work. I think almost every  software engineer / programmer have done similar at some point in his/her life or is lucky enough to continuously doing it. So calling it a hack in a bad way isn’t contextually correct or fair.

Scene 2: 
My garage door motor only worked with a RF remote and I had to carry the bulky remote on my keyring to open or close the door. So I hacked the RF Remote to make it work such a way that I can open or close the garage door using my Mobile (which I generally carry all the time, who doesn't these days?). Keep it light by not carrying the extra weight. Is this hacking? Well yes it is but in my book this is good hacking and I take pride doing this hack job because:
  1. I could so I did.
  2. It works great !! (don't believe me? read the rest of post and/or watch the demo video).

The moral of the story:

  • Do not label generically that "It is a hack", "You hacked it". There're good hacks and then there are bad ones. Understand the difference and acknowledge before commenting. 
  • Hack to improve, not to destroy. You will only be cool when you use hacking in a positive way.
  • Hacking is really a skill set and a talent. 

The story of a hack job (Garage Door IoT'ed)

Requirement:
I want to open my garage door using mobile phone from anywhere in the world.
Why:
What I have is this:


And this works fine, mostly, typically. But I am beyond typical (because I am Batman).
Here're few problems with the existing problem:
  • I hate carrying keys and the additional attention to take the key on the way out and remember to bring it in one piece on the way in. As I am carrying mobile phone anyway I want to use it as a key and shed the extra weight.
  • Sharing keys is another problem. These RF remotes are expensive and I did not want to buy 1 per user/member of my family. If I could convert keys to an app then I can just add/remove user to the app. Pretty convenient, eh!?
  • The RF Remote only works when I am near by the door. This is a problem. So many times I have driven away few Ks only to turn back to close the door. So I NEED an internet based door control switch so that I can close or open from any where (Like Batman).
  • If I am not home and one my friends shows up they would have to wait outside till I get home (this has happened to me and my poor friend on a rainy day). Having control of the door over internet will help a great deal here. (eg> scenario: Batman remotely opening the door to bat-cave when justice league arrives for pizza & marvel night)   
Unfortunately, all garage door motor typically ships with RF remote that you need to carry to open/close the door.
What really want is this:

So you see there's a problem/gap between what I want to have and what I have now.
Challenges:
I have watched bunch of YouTube videos on how to automate/IoT garage door (actually that's most people's first DYI. For me it is the 2nd. See the first one here: Smart wifi controlled irrigation system). And pretty much all of them involved some form of live wiring and attaching things to the door motor. But I wasn't too comfortable with the live wiring part + all the attachments seems to make a mess up there. So I had to find an alternative approach and get creative about it.

The solution:
After staring at the wall for a weekend I found a way that worked for me. So the alternative approach is *drum roll please* hacking the garage door remote.(It is the first of its kind, I think, at list I have not seen/found this solution on the internet yet).


The garage door remote is a RF Remote which contains a tiny circuit powered by a battery and when a button is pressed to open/close the door it closes/completes the circuit (like a relay). So all I needed to do is to somehow mimic that button press using an IoT device that I could control the IoT switch over internet using my home assistant and the IoT switch will control the button press of the RF Remote.
This way I do not need any live wiring to the garage door motor itself or attach anything to it; in fact, the whole thing can be nicely tucked away in some corner of the house and it will function just fine.

I chose

  • Sonoff SV as relay for it's circuit isolation and ESP8266 based circuit properties. 
  • Tasmota firmware to flash the ESP8266 for its MQTT usability.
So here's what I did:
  • Flashed the sonoff SV with Tasmota firmware so that instruction can be passed on based on MQTT messaging.
  • Isolated the onboard relay from the main circuit controller chips.
  • Made the relay part of the circuit a dry circuit because the RF Remote circuit already has a power source so cannot have another voltage flowing through the relay.
  • Hooked 2 wires from the both side of the push button and attach to the sonoff dry circuit. This way when the relay closes it will complete the circuit in the RF Remote mimic-ing the button press.
  • Finally added a 5V power supply to power the ESP8266 circuit.
  • I programmed in Home Assistant a MQTT switch. Then programmed an automation to trigger when the switch is on and action to turn off after 200ms. This way the MQTT switch will behave like a toggle button.

YouTube:


Photo Gallery:

Sonoff SV

Garage Door Remote

Garage door circuit wired to Sonoff SV

IoT'ed garage door control in a chocolate box

Cost:

Sonoff SV = $8
Garage Door Remote = Free (Spare. If no spare then $15)
Tiny gage wires = $0.10 (for a whole metre)
5V Power adapter = Free (spare, If no spare then $9)

Total: $8 AUD (or worst case $32).
Can you price beat this with any off the shelf?

What's next:

This solution however has one flaw.
The garage door remote works based on toggle (meaning 1 click is close, 1 click is open, 1 click when on movement is pause) and the manual RF remotes are still in function (I have another one in the garage itself).
This creates an issue of keeping track of what state the door is in (open or close or paused half way in the middle). 
So I need some way to determine what is the door state and result of the state after my action.
(I do have a solution in mind, but that's a topic for another day).

Result:

Hacking improved the convenience in my everyday life.
#HackToImproveLife





Comments

Popular posts from this blog

Managing devices using Edge Manager

Managing edge devices has been a complex process as traditional IT ops tools fall short in distributed, low-connectivity environment to manage huge quantity of devices.  Red Hat Edge Manager  (Open source project: FlightControl , GA'd by Red Hat on late Jan, 2026) solves these challenges by providing streamlined management of edge devices and applications through a declarative approach . Now, there's a fair bit to unpack here. But for simplicity this is how I am going to map those 3 things here: Management of edge devices: I am mapping this to LCM (including upgrade, patch etc) of the underlying OS (in this case RHEL OS of BootC flavor or at least UBI based RHEL ). Managing applications: Mapping this to deploying applications and LCM of the applications stack on the OS. Declarative approach: This one is super interesting. To me this is very K8s-yy but in the world of edge devices running linux (RHEL OS, as of today). And then this thing also has MCP : This is my next prob...

Passwordless Auth to Azure Key Vault using External Secret and Workload Identity

I want to fetch my secrets from Azure KV and I don't want to use any password for it. Let's see how this can be implemented. This is yet another blog post (YABP) about ESO and Azure Workload Identity. Why Passwordless Auth: It is a common practice to use some sort of "master password" (spn clienid, clientsecret etc) to access Secret Vaults (in this case it is AZ KV) but that master password becomes a headache to manage (rotate, prevent leak etc). So, the passwordless auth to AKV is ideal.  Why ESO: This is discussed and addressed in the conclusion section. Workload Identity (Passwordless Auth): Lets make a backward start (just for a change). I will try to explain how the passwordless auth will work. This will make more sense when you will read through the detailed implementation section. Here's a sequence diagram to explain it: There's no magic here. This is a well documented process by microsoft  here . The below diagram (directly copied from the official doc...

Speeding using Crossplane and ServiceBinding

Software development and release processes continues to improve to deliver value to the users faster and better to support business growth and relevance in this competitive market. To achieve this we focus on automating the path to production and any people or process related obstacles of a software on its way to the user. Generally, some of the goals of the golden paths, are: Remove interdependency and promote self service and  provider & consumer relationship. Shift left - from people & process to technology & automation . Treat Platform-as-product and provide PaaS Secured and standardised by design In this post, I will describe how Crossplane and ServiceBinding can help achieve these goals in the context of applications development and delivery and their consumption of external resources / services in the process. Note:   Crossplane and  ServiceBinding both are capable of covering beyond just database connectivity. In this blog post I am describing Dat...

A modern cloud native (and self serve) way to manage Virtual Machines

Really!! Are there could native way to deploy, LCM VMs and add Self Serve on top ???? In this post I will describe an art of the possibility using the below tools: RHDH: Red Hat Developer Hub (Open source project: Backstage ) OCP Virtualization: Red Hat OpenShift Virtualization (Open source project: KubeVirt ) AAP: Red Hat Ansible Automation Platform (Open source project: Ansible / AWX ) RHEL BootC: Image mode for Red Hat Enterprise Linux (Open source project: bootc ) GitOps: Red Hat OpenShift GitOps (Open source project: ArgoCD ) Quay Registry or any other OCI compliant registry All of these projects can be run on Red Hat OpenShift (Open source project: OKD ) OR on other Kubernetes distribution or on VMs (you pick your underlying infra. For this post I have used OpenShift for simplicity of deployment, integrated tools and narrowly focusing on the usecases instead of the deployment of the tools).  The main goal here is to: Easily deploy and lifecycle applications and stuffs ...

Deciphering the hype of Service Mesh

Service Mesh is not a new topic anymore. Most of us in the industry are already familiar with it. There are also tons of article in the internet about its why and how. In my opinion, it has a significant influence on the application architecture. Here's a DevSecOps humor to start the discussion (and it will make sense as you read along).  This is part 1 of my 3 parts blog posts on Service Mesh. Part 1:   Deciphering the hype of Service Mesh Part 2:   Understanding The Ingress and The Mesh components of Service Mesh. Part 3:  Understanding the observability component of Service Mesh (TBD).  In this post, I am going approach Service Mesh from an application architecture point of view. I will also score some of its basic features on a scale of 1 to 5, where 1 being the least important to me and 5 being the most important.  Table of contents: Common Q&As Features mTLS Service Discovery Meshing Ingress, Gateways etc Telemetries Enterprise products and offeri...