My First Apple Watch App

The last couple of posts, I talked about using a Raspberry Pi board to act as a WiFi switch to my garage door opener. I first used a Raspberry Pi 3 Model B, and then switched to a smaller form factor and more power efficient Pi Zero W.

I spent a lot of time writing security code on both the Pi Zero and iOS App so that the cipher and keys are in sync. I even threw in a time based HMAC algorithm so that the code being sent from the iOS App to the Pi Zero rotates every 30 seconds. The challenge here was the use of different languages and packages involved. I am using Node.js on the Pi Zero, so I had to get the
crypto module from Node to work with the Apple’s <CommonCrypto/CommonCrypto.h> module in Swift. Since this is my first real Swift app, it took some time to sort things out. Why all the fuss with security? Because I only wanted certain devices (Phones and Watches that my family owns) to open my garage door.

I took the plunge to writing my first watchOS app. I thought it would be more convenient to open the garage door from the wrist instead of hunting for the iOS app on the phone and fiddle with the large screen.

After testing the stability of the WiFi on the device for over two weeks, I found the responsiveness to be pretty rock solid. Good job Raspberry Pi! I finally hooked it to my garage door opener, and long story short, I get to see the fruits of my labour. Check out the video below.

I am super happy with the outcome. I now have a remote garage door opener that will work anywhere in the world as long as I have WiFi. I don’t have an extra box lying around in the house that some suspicious third party manufacturer may have access to. This solution is totally private, secure, and power efficient!

Next step is to add a camera to the Pi so that I can actually monitor the garage door as it opens. The camera will be quite helpful if we have any drop off or pickups. I may even research how I can get Apple’s HomeKit connected to the unit.

On the software front, I still have to do some minor user interface clean up, and raise the security level another notch by using https.

Leave a Reply

Your email address will not be published. Required fields are marked *