OpenHAB Home Automation
Tags: automation, privacy, security, iot
Published: 2020-04-26 00:54:18

_This is part 1 in a series of posts documenting what worked and what did not while building a privacy and security focused smart home_

IoT and the smart home realm of electronics is largely a joke in the security industry. Smart locks and garage door openers provide little to no physical security against a hacker or someone with one of their tools [[1](https://techcrunch.com/2019/07/02/smart-home-hub-flaws-unlock-doors/)] [[2](https://blog.rapid7.com/2019/08/01/r7-2019-18-multiple-hickory-smart-lock-vulnerabilities/)] [[3](https://www.cnet.com/news/smart-lock-has-a-security-vulnerability-that-leaves-homes-open-for-attacks/)]. Smart bulbs and other "innocuous" IoT devices can be used for infection and propagation of malware, and en masse can pose a risk as botnets [[4](https://www.csoonline.com/article/3168763/university-attacked-by-its-own-vending-machines-smart-light-bulbs-and-5-000-iot-devices.html)]. Cameras spy on citizens and provide intel to foreign (or sometimes domestic) governments[[5](https://www.reddit.com/r/wyzecam/comments/9zioog/do_these_still_spy_on_you_was_gonna_get_one_on/)]. The point is, IoT devices are either wilfully or negligently full of security flaws that punch holes in your network and let attackers in or leak your personal data out.

...So why on Earth am I building myself a smart home? Because I want this:

"Hey Mycroft, turn on my kitchen lights."
"Right away."
_Four light fixtures turn on at once_

How freaking cool? We're living in the future, folks.

But how do I do this without compromising my privacy, or my network security? I've done a lot of research and I think I've found a decent compromise. Leaning heavily on open source software, I'm building a home automation network with [OpenHAB](https://www.openhab.org/), [Z-wave](https://www.z-wave.com/), and [Mycroft](https://mycroft.ai/). Let me explain why this is a good solution.

Z-wave is a mesh network protocol that creates a "LAN" of IoT devices that are, themselves, never connected to the internet. These mesh IoT devices connect to a Z-wave "hub" that _can_ be connected to the internet, if you want it to (e.g. if you want to control your smart home from oot and aboot). The hub sends commands to the devices, updates the devices, and overall coordinates the smart home show. There are plenty of Z-wave hubs already out there (*cough* SmartThings *cough*), but I wanted something less opaque that would be amenable to the addition of some non-z-wave devices, such as the Wyze cam. Something more... open source.

OpenHAB is a powerful smart home automation suite that frankly has impressed the socks off of me. This thing was clearly architected by people who knew what they were doing from a design standpoint, because their concepts (bindings, things, channels, items) generalize so well that once you understand the OpenHAB ecosystem, it's a joy to add and control a new device. _It just works_. I love open source success stories. OpenHAB has a binding for Z-wave that allows it to act as a hub as long as there's a Z-wave serial device present on the system. It also has bindings for all sorts of other things you might want to integrate with your smart home solution, including for example Spotify. The beauty of a single-stop solution like OpenHAB is that you can gather all your state information in one place, and use it to create complex interactions between your home devices.

While OpenHAB even provides a means for creating custom UIs for controlling your devices, sometimes talking to your house is just more natural (or more awesome). But voice assistants are all cloud-based services because the hard work of lexing human speech and deriving meaning is the work of an AI, and sadly, they seem to require more horsepower than a raspberry pi. Even more sad, though, is that these cloud-based services snarf up your data and sell it to advertisers. There's no guarantee that they aren't always listening. an indeed there's some evidence that they are, and that our personal moments are being recorded and transcribed by humans in order to improve the AI's speech recognition (I read this article, but I can't find it now - guess you will have to take my word for it).

Mycroft is a cloud-based AI service, but it is open source, to the degree that it is possible. It requires an online account in order to link your Mycroft instance to its cloud service, and their privacy policy does contain language that enables them to sell your data to advertisers. They swear that they don't - being privacy conscious and respectful of their users is their biggest selling point and something that they tout on their website - but they absolutely could. It's up to the end user if they believe them. I decided they were the lesser of all the evils, and I'm excited about the potential to write my own skills for Mycroft, as its skills engine is python-based. It also integrates with OpenHAB, giving it access to all of the items exposed through OpenHAB's configuration. In theory, one can create Mycroft commands to control literally any of the smart home things.

Here's the shopping list so far:

$100 [Raspberry Pi 4 Kit from CanaKit](https://smile.amazon.com/gp/product/B07V5JTMV9/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1)
$39 [Zooz Z-wave Plus 2 USB Stick](https://smile.amazon.com/gp/product/B07GNZ56BK/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1)
$30 [Zooz Z-wave Toggle Smart Switch](https://smile.amazon.com/gp/product/B01A3SBTM6/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1)
$9 [PS3 Eye Microphone](https://www.walmart.com/ip/Sony-PlayStation-Eye-PS3/20470320)
$35 [Raspberry Pi 3 B+](https://www.adafruit.com/product/3775)
$25 x3 [Raspberry Pi 3 A+](https://smile.amazon.com/Raspberry-Pi-Model-A-256MB/dp/B00PEX05TO)
$25 [Wyze Cam V2](https://smile.amazon.com/Wyze-Indoor-Wireless-Detection-Assistant/dp/B076H3SRXG)

That all runs a bit over $300. Expensive, sure, but what's life without a hobby. What all this buys me so far are three sets of networked and synchronized speakers (hooked up to Pi 3 A+'s running [Max2Play](https://www.max2play.com/en/)), a voice assistant (the PS3 eye attached to the Pi 3 B+ running Mycroft.ai, using their [picroft](https://mycroft-ai.gitbook.io/docs/using-mycroft-ai/get-mycroft/picroft) image), a solitary smart light switch, a camera to watch my front door, and a home automation hub (the Pi 4 with the Zooz Z-wave USB stick). So... I can turn on a single light, play some music, detect when someone's coming into the house, and ask the internet some questions. It's not bad but it's not exactly like the house is _alive_. All I've bought so far is proof of concept toys.

I'll continue this series with posts about each individual node in the smart home network, including any relevant configuration, wiring, networking, travails, and triumphs. For now, I wait for the pieces to come in.