DIY August Smart Lock Wi-Fi Bridge
I briefly mentioned the Wi-Fi bridge used for my August Smart Lock in my Control Practically Anything with Alexa post. I'm writing this post now to describe it more in detail.
The August Smart Lock allows you to unlock a deadbolt with your smartphone. It uses Bluetooth to achieve this. August also sells a Connect device which is essentially a Wi-Fi bridge. You put this bridge near the lock inside of your home and you can now use the smart lock without having your phone near the lock. Great? Right?
There are a few problems I have with this:
I'm cheap. The darn thing is like $60.
Communicating with the August cloud servers is kinda scary for me. I mean, it unlocks my door!
The solution? Build your own. You only need a Raspberry Pi Zero W and some neat software I found on Github simply called Augustctl. I forked a copy of it here. The Raspberry Pi Zero W has Wi-Fi and bluetooth already built in. It's super tiny and you don't need to use any of the GPIOs - you just need to give it power and configure it.
Oh - wait, I lied. You do need 1 more thing: A rooted Android device. This is required to copy the offline encryption key. Once you have this key, the Raspberry Pi can communicate directly with the Smart Lock and not have to go to the Internet.
Getting the Offline Encryption Key
- Get your rooted Android device.
- Install the latest August Home app APK (you will have to install it from the APK because the Play Store will not allow you to install the app on a rooted device). You can use the usual search engines to find the APK like this.
- Log into the app (I forgot to mention that you should have already registered an account in the official app and used it at least once to work with the Smart Lock using the regular smartphone Bluetooth method). Since you are already registered, it should get the info needed from their servers.
- To get the key, view this file in the rooted Android devices local filesystem:
Record the offline key and offline key offset. Keep it in a safe place!
At this point, you can uninstall the August Home app running on your rooted device. You won't need it once you have the key and key offset.
Setting up the Raspberry Pi
- Install the latest Raspbian lite.
- Configure Wi-Fi and anything else needed so you can connect via terminal (like SSHD). I also suggest changing the GPU memory split so that the GPU receives the least amount of memory (16MB). This thing should run headless.
- Update to latest packages and then install some pre-reqs:
sudo apt-get update && sudo apt-get upgrade -y sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev nodejs npm git
- Clone the repo:
git clone https://github.com/leonowski/August.git
- Change to the directory:
- Use NPM to install some required packages:
npm install bluebird debug noble underscore
Edit the config.js file to include the offlinekey and offset. You can comment out the "config.httsServerPort" if you're not going to use SSL. You can configure the config.httpServerPort port to something other than the default 8080 if you wish.
Now, all you need to do is run the server using node:
sudo node august-server.js
You can use curl to interact and test the server. Here are some commands:
curl http://localhost:8080/august/control/status curl http://localhost:8080/august/control/lock curl http://localhost:8080/august/control/unlock
The status command might drain the battery - you can instead use the cached status command to get the last known status. If you're only using this app to control the lock, then the cached value will always be correct:
Once you have confirmed that it is working, you can use NPM packages like forever and forever-service to keep the nodeJS server up and running, well, forever. :)
Now - how do we make it work with Alexa? Simple - use the ha-bridge I mentioned in my previous post! Bada-boom, bada-bing!
As always - if you need help, drop a comment below or hit me up at email@example.com!