For quite some time I have wanted to setup some home automation, but being dependent on cloud services was always a no-go for me. Stories of companies getting bought out or divisions sold off and then the services going dark and leaving devices as useless bricks, and the idea that if our internet goes out (a not infrequent occurrence at our home) and things stopped working entirely kept me from ever going through with it.
Then I discovered communities of people who do home automation without the cloud. Projects like HomeAssistant, OpenHAB, etc. Local control of devices, with their own frameworks to build automations as you want and no cloud required.
Now, don't get me wrong, if you dive in to the code you will find your own s in each of them, and suspect design and architecture decisions, technological debt, etc. One I found particularly amusing was how HomeAssistant, until current version, had you defining the logic for automations inside of monolithic YAML files. Programming with markup. -shudder- And to make matters worse, errors in your YAML file would cause the entire stack to completely shit itself, requiring fixing the YAML file over SSH if you were lucky. If you weren't lucky....well......perusing their forums for answers to some things I found recommendations to pull the hard drive or SD card from the HomeAssistant server and mounting it to another machine to fix issues with YAML. So.....not exactly user friendly, nor gracefully handling errors.
But anyway, so I decided to use HomeAssistant. Mostly because it has good integration with MQTT and I have worked with that much more than I want to think about. It also has a pretty clean interface, and they really seem to be working on shedding technological debt and fixing things. Not that there is anything necessarily wrong with the other options. HomeAssistant just seemed to have the more active community and mostly better integrations for what I wanted to do.
So what have I done? Well, one thing that has always bugged me is lights being left on, sometimes for days or weeks at a time, and being very wasteful. Lights in the back of our basement in the mechanicals room don't get noticed and left on. We constantly left the garage lights on as the door going out to it is solid and we wouldn't notice. Lights in the attic would be unintentionally left on for fuck knows how long. Stuff like that. We also have lamps in our living room that we would never use because goddamnit I've already sat down and I'm not getting back up and if I do then I have to turn the fucking things back off before I go to bed. Basically laziness.
So as I set everything up I made a bedtime routine that would turn off all lights that we did not want on overnight. No more leaving lights on in the basement or garage. I also tied the light switch that controls the lamps on one wall to trigger the lamps on the other side of the living room to turn on and off with them. I also setup all the rest of the lamps in the house and made bedtime routines for the boys, setting all of their room lights off and turning on their nightlights until morning.
Another nifty routine is that when we leave the house all of the lights in the home are shut off, and when we arrive back home all of the hallway lights, the kitchen lights, the entryway lights and the dining room lights come on automatically. HomeAssistant does presence detection of my wife's and my cell phones and when both of them have left it triggers an away routine and when one of us returns it triggers the home routine.
As a welcome departure from configuring routines in YAML, HomeAssistant can use NodeRed, which is a pretty spiffy drag and drop flow generator. If you're not familiar with it, you should check it out. The backstory is pretty nifty.
Node-RED Introduction – 05:03
— ibmets
All of this is tied in to relatively inexpensive devices running some variation on the ESP82XX chips (where the internet of shit got its momentum from) running open source firmware called Tasmota. One of the best devices I have found that you can load it on to is the Sonoff Basic. A $6 wifi switch that you can wire in to nearly anything you need to turn on or off, and you can even use it with various sensors like PIR, temp/humidity sensors, etc.
The cool thing about DIY IoS is that you're really only limited by your imagination and capabilities. Switches no longer need to be wired via mains to the device they will control. You can have a Sonoff Basic wired in one location with no direct connection to something else and it can control it via MQTT messages. So in the living room when we turn on the primary lamps that switch also sends a MQTT message to turn the other lamps on. You could install a 3-way (or more) switch without ever having to pull more Romex.
"This all sounds overcomplicated and like something a spouse would hate." I can hear you saying. Well, it depends on how you go about it. You could easily make something that your wife would hate. No doubt. But I went about it by following the advice I read on one of the HomeAssistant forums. "Only add functionality where it makes sense, and don't remove existing functionality if you can help it." So all the light switches look like standard Decora switches, everything still works if the internet goes out, everything still works as it did before and you don't have to use any of the added functionality if you do not want to. When you do, it makes your life easier and not more difficult. And my one concession to help her out, help the kids out, and generally make the house work better was I did tie it in to Google Assistant.
Le gasp!!! Don't you have privacy concerns? What if your internet goes out? I thought you said you wanted everything to still work even if the internet goes out!! You have built this post on a foundation of lies!!
Well, of course I have privacy concerns. But unless I want to go back to a flip phone that ship sailed a long time ago and there's fuckall that I can do about it unless I want to be a troglodyte. As for tying in to the internet, yes I have. But only one connection point, and if the internet goes out everything still works except voice control of devices. Switches still work, lights still work, etc. The mobile interface and control panel still work. We aren't dead in the water.
But, and this is a big butt
You can't anticipate everything. Especially not human nature and my wife's ability to ruin well architected systems and controls. The woman could break an electronic anvil, if there were such a thing.
So a week or so ago we had a big install to do and it had to be done in off hours. We arrived around 7pm and by ~3am it was all done except a bit of testing a configuration. As I had been up for, near as makes no difference, 24 hours by that point I decided to bow out.
"I'm coming up on the time that I woke up yesterday, so I'm going to get out of here before I become a grumpy dickhead."
"Do you mean more of a grumpy dickhead?"
"You know that you can fuck right off, right?"
So I head home. I park in the driveway so the garage door doesn't make a bunch of noise and wake people up. I head up the front walk and right as I am in front of the kitchen window......a bunch of lights come on.
The dogs immediately lose their goddamn minds. I can sense that my wife is pissed before I even get my key in the door and I'm really hoping that Gunner doesn't tear my face off before he realizes that it is me because he is very protective of our home at night. I open the door, get the dogs calmed down, then I hear one of the boys open the door to their room. I shut off lights, go to the bedroom and apologize to the wife for waking up the entire house at 4am. She wasn't as annoyed as I assumed she would be. I assume fatigue played a large part in that.
So what went wrong? Where did I fuck up the programming so that all the lights would come on when I came home at 4am? What If statement did I comment out for testing and forget to restore?
Well, none of those. A few days earlier we had a short internet outage and my wife turned off wifi on her phone. I do not know why she does this, Android will gracefully failover to LTE if a wifi connection doesn't have connectivity. So it had no idea she was home. As far as the automations were concerned the house was vacant and someone had returned. It did what it should have, even if it was not what I intended. The error was my assumption that my wife wouldn't leave her wifi off on her phone for extended periods of time. An assumption that I never should have made considering that we are on an unlimited cell plan in large part because she has the habit of doing exactly that......and I want to tether whenever I want and not get charged out the posterior.
She mentioned later that morning that she thought it was odd when all the lights went off when I left. I reiterated exactly how that works, and how if I leave and lights go off that is because she probably has her wifi off on her phone and maybe check that in the future so there is not a repeat of the Great Awakening of 2021. We will see how well that plays out.
Some other notable fuckups on this journey:
As I was making routines I made one where if you say "Okay Google, all lights on" it will turn on every single light under automation. I thought something like that might be handy if there were ever a fire or emergency at night. Turn on all the lights to make getting out of the house easier. Well, we have a 5 year old who is in speech therapy. So when he tried to turn the hall lights on early one morning, and did so via Google Assistant.....yep, every fucking light in the house came on at 6:30am on a Saturday morning.
But that led to another interesting use of the automation. He has a habit of turning on all of the hallway lights when he wakes up early. Even though we have night lights that light up the floor the entire way to the kitchen and such, he always turns them on. That annoys me, and he always turns them all the dimmer all the way up when he does. Like he is trying to annoy me even more. So now, between the hours of 5am and 8am if the hallway lights are turned on it starts a 3 second timer and then turns them back off. That's fun and it annoys him to no end.
As for Google Assistant......it's pretty good for the most part. But occasionally it will totally fuck up a voice command. We have a Nest Mini in my bathroom and one night I was showering and I wanted to switch to my "Cold" playlist and when I said:
"Okay Google, play Cold playlist on Spotify."
That dopey cunt replies with:
ο "Okay, playing Coldplay from Spotify."
"Don't you fucking dare Google, or I will run you through a goddamn woodchipper."