Friday, July 27, 2018

Journey Into The Home Automation Sinkhole

Home automation. There have been many products, ecosystems, and clouds pushed over the years that claim they are The Best™ at automating your home. Recently with the wave of IoT devices, companies big and small, foreign and domestic, real and fake have been clamoring to get into the home automation space. This leads to fragmented homes with multiple devices running across multiple apps on your phone. If you decide to lock yourself into an ecosystem, it's expensive to get out. Hell, it's expensive to stay in some ecosystems (*cough* nest *cough*). But, the real question here (at least for me)... could we build a better smart home out of 'dumb' electronics or make electronics that are smart and extensible. Of course we can. Companies don't because they wouldn't make money that way.

Permit me to reminisce.

When I was a kid (I'm talking early 2000s here), my dad was crazy about X10 Home Automation. The system that still runs our house today was designed and implemented back in the 70s and it works fairly well. There is no wireless connection and a simple stateless architecture. Generally, X10 worked by downloading a program to an interface plugged into a wall. The interface would then send commands through the house power lines instructing modules on the "network" to do things (switch on or off, dim, etc.). They also sold RF transmitters that would send signals to transceivers that did roughly the same thing.

To this day, X10 controls our house and our Christmas lights. The system is pretty good. It has its flaws (signals can't survive the capacitance of long extension cords, power strips, or power scrubbers) but it worked pretty well. We operate on the same hardware and the same program (X10 ActiveHome Pro) that we made back in the early 2000s. It's the only reason my father has kept his old Dell 8300 for this long: X10 ActiveHome Pro is installed on it, it's hard to move to another platform, it's probably not compatible with Windows 10, and outdated overall.

Very early on, we locked ourselves into the X10 ecosystem. We bought several AirSight cameras to liter around the home. These cameras sucked, but they were extendable. We used ContaCam for our motion detection running on a computer in the basement. It works well, but it introduces a massive strain on the wireless network. I can tell the difference when all of the cameras are working and streaming to the computer in the basement.

Another issue I see with a lot of home automation is how reliant it is on the cloud. If your internet goes down, you're dead in the water. That's awful. Why is my 'turn my light on' command being routed through the cloud to my smart switch or smart bulb? Why can't I just route everything through my home network and it only go to the cloud when I'm not on the network? From here, I knew I wanted to roll my own solution.

I wrote about this in a Github repo earlier when I had motivation (and time) to implement it. It was all about security cameras. I noted there were three kinds of cameras: cheap MJPEG cameras that are open to extension but are also very liable to fail, Nest-like cameras that are connected to the cloud and require an expensive subscription to be useful, and a DVR/8 Camera-like system that may be overkill for most users. My idea was to use Android phones as cameras that did motion detection on device. They would stream 24/7 to YouTube on a private-to-your-account stream (which also allows you to share with other accounts like your family) and upload in full resolution motion events. They'd also, of course, be open to extension.

This has its pros and cons, sure, but I figured I could work this into a whole solution. Like I said at the outset of this post, I want to make dumb things smart, and smart things easier to build. Here are some ideas I have in mind for this:
  • Extendability Is Key - The whole point of this is to not be locked into an ecosystem, so you'll see very liberal use of the adapter pattern throughout this long project.
  • Simplicity Is Important - My idea to keep this in check is to have a central message bus (on network) that events get published to and can trigger actions. Think of it as a private version if IFTTT. I'm thinking MQTT for this, but that could change. Any PubSub server would work and the more well used the protocol, the higher the chance of other frameworks supporting it.
  • Keep The Cloud Out Of It - Ideally, the only thing I see the cloud good for is getting messages into and out of your network. The only thing that should be connected to the cloud from your home is the central hub. So, if you're out somewhere and you want to turn the lights on, your phone sends something to the cloud, and the cloud sends something to the hub. But if you're home, the cloud isn't involved. You publish straight to the message bus. In this way, the cloud is more of a client than a service.
These three things will be the most important driving factors in my endeavor to make my home smart. I have many new and old things I'd like to automate, so that means there will be a lot of compatibility gaps I'll have to bridge. But, if done right, it should be ridiculously extendable to the point that anything can talk to anything. Yes, including X10.

So that's the dream. I'll begin working on things like this. My initial idea is to make Calvin - my smart speaker - the hub that I'm talking about. A lightweight MQTT server shouldn't be too challenging for it to run alongside the Calvin AI stuff. But that means I have to assemble it, and who knows how long that could take. I mean... it's almost been a year. The HDDJ turntable is still sitting in my closet waiting to be finished. I just have to do it, which means I have to force myself to find the time.

No comments:

Post a Comment