What I Made in 2020, Part 2

Ethan Kaplan
while(true)
Published in
9 min readJan 12, 2021

--

In my last post I talked about my home network. Since that post was made, I extended it even further by adding access points on either end of the property to cover curb-to-curb, as well as doing a “building to building” bridge as an alternative to laying cable out.

This post is about the other part of the house: the home automation systems.

I have the kind of mind that breaks everything down into logical systems. So to start, I began by grouping distinct systems based on the types of things they would control.

  • Lights and Power: Basically lighting and power based systems
  • Environmental Systems: Thermostats, temperature sensors and soon water sensors. This also covers the pool temperature and the cars.
  • Sensor Arrays: Mostly covering temperature, humidity and presence
  • Contextual Systems: These are systems that are device, context or task specific, which includes the pool, TV’s, home network, etc.
  • Automation Systems: Systems that handle inputs and perform actions based on them. I don’t use just one.
  • Control Systems: Systems made to control the above, including voice, mobile, computer based and a central hub.

Binding all this is Home Assistant, which on a literal level takes inputs and lets you manipulate them to outputs. In the houses case, its taking inputs from all the systems above and executing actions upon devices in these systems. Some of the devices are only sensors, with no ability to manipulate actions, but most have actions.

Lights and Power

At our old house, we had far fewer lights, so the effort was made to automate all of them. In theory, this is fine, but in practice, you end up with a lot of little computers in the wall that are subject to breaking.

In our new house, I focused on lights that were the most likely to need automation to transit in the dark (ie, hallway lights) and lights that were not turned on for single usages (closets and bathrooms).

All in all, we have 36 automated light switches in the house, which is about ⅔ the total switches.

Technology wise, the last house used Insteon, but that locks you in to a single vendor of switches. This time, I decided to pursue an open-source option. In the last year, there’s been a trend on buying cheap Chinese made switches and re-flashing them with either ESPHome or Tasmota, both open-source based firmwares.

Sadly, the cat and mouse game caught up with the community and the vendors locked a lot of these efforts out with changes to their firmware and chips. I managed to grab switches before this took place, and there are now options for pre-flashed switches.

The process is by no means easy. You have to over-the-air flash each switch, preferably on a work-bench, then configure it. This includes letting it join your network, having it talk to MQTT (more on that later) for communication, and if you are doing three-way switches, having it join a group and communicate over multicast.

The benefit is that these switches are cheap, around $20–35 a piece, and they use Wifi without ever “calling home” or needing a central hub.

I use Tasmota on all dimmers, light switches, light bulbs, LED strips and even on/off power bricks, both inside and out.

Tasmota Documentation and Links:

  • Tuya Convert — I used this to do OTA (over the air) re-flashing of light switches. It doesn’t work as reliably anymore, but still works with Martin Jerry switches as of now.
  • Tasmota Device Repository — where you can find compatible devices, and the configuration steps necessary for them, as well as buy-links for them.
  • Pre-flashed switchesCloudFree is one of a few people selling pre-flashed Tasmota switches. No dimmers yet, but they have light bulbs, plugs and switches.
  • Three way switches and device groups — smart switches don’t play nice with traditional three way wiring. The best way to handle this is using DevGroupNames and multicast from the light switches. You have one “primary” switch control the load to the light, and the “remote” switches just powered by line and neutral. Each switch is part of the same DevGroupName and will sync automatically, including dimming. Works perfectly. It also works between switches and Wifi Bulbs and with four way switches. This video is a good overview too.
  • Garage doors— both our garage doors are automated using contact sensors and ESPHome flashed NodeMCU devices. I used this guide as inspiration.

Environmental Systems

I used Nest at the old house, but Google has progressively locked the devices down to be unusable in an open-architecture home. We switched to Ecobee, which got us a few things: an open API and Alexa.

Alexa comes in handy because the thermostats are in high traffic places. They also double as announcement speakers.

Ecobee has little sensors you can put in different rooms to track occupancy and temperature. They don’t poll very frequently, but do a good job at balancing temperatures.

Sensor Arrays

EcoBee provided temperature sensors, and many other devices expose sensors as well. Any device that provides temperature is aggregated, including temperatures from computers, the pool, the Tesla and all the thermostats.

Anything that can spit out time domain based data is aggregated within Home Assistant.

Contextual Systems

These are systems that are very specific to the things they maintain, but due to Home Assistants open source nature, I’m able to aggregate into one platform. That includes the Tesla Model 3, the Pool (using the iAqualink integration), Sonos, aforementioned Ecobee, Ubiquiti’s Unifi system, the Synology NAS and Roku (to control the TV’s).

When you integrate each of these, they create entities within Home Assistant, thereby exposing their systems to automation and control. For instance, hooking in the iAqualink exposes the pool and spa systems, including pumps, heaters and lights. They appear as devices with all the same capabilities as the light switches.

Automation Systems

There are a few ways to automate using Home Assistant. The easiest is to use the built in automation system, which is pretty simple, but can be more complex if you ditch the UI and go into the config files.

Automation called at 7AM to raise my son’s blinds

I use Home Assistant automations for some things but for the most part I automate using a system called Node-Red. Node-Red isn’t only for Home Assistant but it compliments it well. It’s a node/flow based automation system that is really powerful, but pretty difficult to use in some respects.

Some cool automations we use:

Presence

This monitors the state of my wife and I. We have geo-fences around “home” and (hah) work. Anything else is “travelling”. The “Location” conditional checks if we are traveling, and if so, will lock the door. If the state has changed to “home” it unlocks the door, then broadcasts over the Alexa Echo’s “Ethan/Amy is home” as well as pushes that to the Home Assistant application.

We do a have a room based presence detection (you see it in the screen shot of the dashboard for the cat), but that’s a separate article.

Presence Automation

Doorbell / Entry Gate

This automation is triggered by the door bell and the entry gate camera. I put rate limiters on both, as well as daylight sensors for the audio notifications.

Door and Gate Automations

Light Automations

Light automations are tricky, as if they don’t work everyone gets angry. So to start, I have some soft touch automations in place. The first is when the door unlocks (someone came home), and the sun is down, it lights the path from the garage to the front stairs as well as the back stairs.

The other is a simple automation to close the curtains in the master and turn on the porch light when the sun goes down. We also have one that closes the blinds in my son’s room, turns on the fairy lights in my daughters room and turns on both their bedside lamps at sundown.

The final one is a good illustration of how Home Assistant can “bind” many devices together. This uses the Roku integration to watch the state of the family room TV. When it’s turned on (which you can do over Alexa or Siri!), if the sun is down and the light over the TV is on, it’ll dim it. Stupid, but fun.

We just finished automating most of the lights in the house, so I’ll be working on more automations as we go.

Some light automations

Control Systems

I love dashboards, control panels and the like, and if I could do it, my kitchen would have an old school nuclear power plant style button/dial/switch wall. But I am married so that isn’t possible. In order to control the house, I wanted to make sure that anyone could control anything from anywhere.

The dashboard is a Planar Helium PCT2235 touch screen and I use Touch Base as the touch screen driver for the MacMini. The MacMini is bracketed to the back.

To do so, I built a dashboard using a touch screen monitor with a MacMini, a mobile version of this using Home Assistant’s app, as well as mirrored the home’s lights and switches in both Alexa and HomeKit. Homekit also provides an alternative dashboard on all the Mac’s and phones.

For Alexa, we have devices around the house including Echo Dots, Echo Flex’s and the two thermostats which are also Echo’s. I use a plugin called “Alexa Media Player” to use these as text to speech (TTS) devices for Home Assistant. This lets me do things like intercept the doorbell ring from Ubiquiti, and have it announce “Someone rang the front doorbell” over the Alexa.

The Mustache template in Node-Red that handles announcements.

HomeKit integration lets us use Siri to control lights, garage doors, door locks and the like, as well as integrating with the surveilance cameras. We don’t use HomeKit for automation except I use it as a backup for geofencing as HomeKit’s “is Ethan home” functionality is OS based and doesn’t rely on the HomeAssistant app background fetching and geo-fencing.

Alexa has two forms of integration. There’s the “Alexa, turn off the kitchen lights” which Home Assistant’s cloud integration handles. But I also have a custom command that sends intents to another Home Assistant adjacent service called AppDaemon. AppDaemon is basically a Python app container. I could flow intents to Node-Red or elsewhere, but I wanted more code level control. I use AppDaemon to do read-backs of system status (“Alexa, ask Tranquility Base it’s status”) or to trigger automations (“Alexa, tell Tranquility Base I’m going to bed”).

Bed time flow is triggered by “itsbedtime” event that is broadcast to all listening systems. Node-Red is one of them and responds by checking if garage door is open, and if so asking me (via Alexa) if I want to close it.

Of note, Alexa and Siri are better and worse at different things. For instance, Siri is way better at opening doors and locks, while Alexa “hears” better because I have Echo devices scattered around. Having both options lets me talk to my watch or phone, but also just randomly shout things to Alexa.

The phone and control system use the same dashboard, but it’s always in flux. The nice thing (and not so nice thing) about Home Assistant is how flexible it is. I was inspired most recently by this design.

Other Systems

All told there are 13 Docker Containers running:

  • NodeRed — flow and rule based automation
  • MQTT: I run the Mosquito MQTT broker. MQTT is a communications bus for IOT devices. My light switches and a bunch of other stuff use it.
  • WatchTower: Automatically upgrades all the other docker instances. Comes in handy for Home Assistant which has regular releases
  • Home Assistant (HASS)
  • Portainer: I use this to manage Docker
  • Nginx / CertBot: I use CertBot and NGINX as the public facing part of the house. NGINX / CertBot configuration is a pain in the ass, but it works. This article and this one is what I used to setup AppDaemon (below), Alex anat Nginx/Certbot.
  • AppDaemon: Python container for home automation
  • InfluxDB / Grafana: Totally unnecessary but stores time domain data for graphing.
  • SSDP-Relay: Relays multicast communication across VLANS for AppleTV, Sonos, etc
  • Tasmoadmin: Lets you administer Tasmota based light switches easily
  • PiHole: I use PiHole as an ad blocker on top of the ad blockers in Safari and Chrome

If you have any questions on the above, comment here or Tweet me at @ethank

Next in this series, how I managed to move, renovate and automate using Notion then Coda.io

--

--

music+technology - geek and fan in equal measure. ex chief digital officer at Fender