Info

Year

2017-2018

Languages

Python, C++, HTML/CSS, PHP

Platform

IoT Components, Raspberry Pi, Philips Hue, Zigbee, Energenie

Back to Projects

Vendor-agnostic Home Automation

In 2017, I moved into a new house and wanted to start integrating home automations. I generally have a healthy distrust of IoT applications and wanted to build a system that would be easy to manage but not depend on components that couldn’t continue to run if the vendor went out of business.

This page documents the components that make up our home.

Overview & Philosophy

I had three clear requirements when I started building a home automation system:

  • Security - Devices either needed to be regularly supported or could be isolated on their own network.
  • No cloud-only devices - A device had to work without relying on the cloud. If the internet connection is down, I want the device to still work. It could have cloud functionality but it had to work without it.
  • Usable by non-techy members of the house - I’m not the only one in the house. And the other person isn’t as tolerant to tinkering with devices as I am.

Methods of Interaction

  • Physical - A smart light also needs to be a dumb light. It doesn’t matter how clever it can get, it still needs to have a physical switch that you can reach for in the dark. Shouting at lights at 3am to go to the bathroom is not always the most fun.
  • Smartphone and web -
  • Automation -
  • Voice control -

Architecture

Component overview of home automation setup

Component overview of home automation setup

The house system is built around Home Assistant as the core software element. This project acts as:

  • Historical database
  • Where devices are defined
  • API endpoint for controlling switches, sensors and other devices
  • Main GUI dashboard

Home Assistant provides a robust community with many integrations to existing products. As the diagram above shows, there are a few hub devices that act as sensor gateways that funnel data into Home Assistant. These different platforms can then be integrated with each other via Home Assistants device definitions and APIs. In this manner I can integrate Philips Hue, Xiaomi Aqara, Energenie, Custom Raspberry Pi devices and more without relying on the vendors locked in software.

Network, Server and Hubs

The house network is based on Ubiquiti Unifi gear. These devices provide quick granular control of your network and allow for more advanced network segmenting, firewalling and VLANing while still being a bit friendly to non-network engineers.

The house network is setup like it might be in a mini corporate network. There are VLANs for:

  • Management devices
  • General desktops and Wi-Fi
  • Servers
  • IoT devices
  • Untrusted IoT devices
  • Guest network

The Home Assistant server in docker runs on a Synology NAS. The synology NAS has two network ports and the second one is used as a connection into the IoT and insecure IoT networks. The insecure IoT network has a firewall setup that prevents the devices from talking to each other or the public internet. They can only talk to the Synology NAS. This then transfers data over to home assistant via a single exposed network port.

In general IoT devices are restricted from seeing the public internet. They are only let through to update once a month. General desktops and Wi-Fi can’t see these devices and have to interact with them via Home Assistant which is running on the Synology NAS.

Components

1. Automating with Node-Red

Most of the automation actions in the house are written using the Node-Red platform. This plugs directly into Home Assistant’s API and can trigger and respond to all sorts of event and timer based actions.

See more about Automations

2. Climate Monitoring and Thermostat

There are a plethora of smart home thermostats on the market all of which provide a wide variety of features. While I looked at Nest and Hive and many of the other popular ones, I settled on the Drayton Wiser system because it provides a hub controller that actually hosts a local API.

Thermostat and status display in living room

The thermostat controller is hooked up to Home Assistant. The thermostat itself is programmed with its own schedule but the thermostat sensor data is recorded in home assistant. As we have other temperature sensors in the house we can also trigger boosts directly from home assistant if we feel the need.

See Drayton Wiser for more information about this thermostat

3. E-Paper Status Display

You don’t always want to look at your phone or the computer to see what the temperature is or how much power is being used. I created a small status display using an E-ink based display.

Read about the Raspberry Pi based quick status display

Quick status display

4. Energenie Power Monitor

My one complaint with the UKs push towards smart metering is the usage of locked down devices and online platforms. I wanted a power monitoring solution that would let me see near real-time usage but also let me log it and store it locally.

Read about the Raspberry Pi based Energenie controller

Quick status display

5. Zigbee Sensor Network

The biggest component of the house network is the Zigbee platform. Based on Deconz this is a Zigbee module that you run on your own hardware. The software is run locally and provides it’s own API and integration with Home Assistant to allow control.

If you’ve ever used Philips Hue or Ikea Tradfri this device replaces their hubs with a hub that you run on a Rapsberry Pi. You can then use your Philips, Ikea, Samsung or Xiaomi devices on your own hub.

Philips Hue motion detector and temperature measurement

6. High Precision Temperature Sensor

Read about the Raspberry Pi high precision temperature monitor

7. Remote Sockets

Before Ikea released Zigbee based smart outlets to the UK, the plugs that I used were the TP-Link HS110 monitoring smart plugs.

These devices connect via Wi-Fi but the plugs themselves expose a local API. The API itself is not super secure so the plugs are on their own segmented Wi-Fi SSID and VLAN which can only be accessed by a special server running on the synology in docker. This custom TP-Link to MQTT Service bridge exposes the TP-link devices to Home Assistant as a series of MQTT devices.

8. Whole House Audio

Chromecast Audio and Smart Plugs

Chromecasts

Kitchen speaker with chromecast and USB speakers

Denon stereo with chromecast, record player and smart plug switch on

Flirc USB IR blaster and receiver

Denon Remote Control

denon_remote:
    url: http://192.168.1.163:8080/command
    method: POST
    #headers: 
      #authorization: !secret rest_headers_secret
      #accept: 'application/json, text/html'
    payload: '{"command":""}'
    content_type:  'application/json;'    

9. Improved Synology Camera Control

The Synology NAS is also used as a controller for a few POE security cameras. These cameras are segmented on the network and can only talk to the Synology NAS surveillance station application over a single port.

I updated the Home Assisstant control of the Synology software. Read about the py-synology update

10. Auto-update of Access Control

The Ubiquiti network controller runs on a VM running in AWS. This provides external control of the network including uptime monitoring. As the house internet connection is on a dynamic IP the strict firewall and VPN tunnel between AWS and the house needs to be updated when the IP changes. This is handled via a python script that updates AWS Security Groups

Appendix - Component Listing

The standard boring shot of a pretend IT closet

Zigbee hub with Raspberry Pi and Raspbee by Deconz

Hubs & Controllers

Device Connection Home Assistant Notes
Deconz Raspbee Ethernet Deconz Used to control all Zigbee smart bulbs, sensors and plugs
Energenie Ethernet Wink Used to connect Energenie power monitoring devices.

Both of these hubs operate on a Raspberry Pi 3b+ w/POE.

Devices and Sensors

Device Type Connection Home Assistant Notes
Drayton Wiser Smart Thermostat Wi-Fi custom notes
Ubiquiti USG3 Router Ethernet Ubiquiti  
Ubiquiti US-8-150W Switch + POE Ethernet Ubiquiti  
Honeywell Smoke Alarm Smoke Alarm Zigbee Deconz  
Xiaomi Flood Sensor Flood Sensor Zigbee Deconz  
Xiaomi Door & Window Sensor Sensor Zigbee Deconz  
Xiaomi Motion Detector Sensor Zigbee Deconz  
Xiaomi Push Button Wireless Switch Zigbee Deconz  
Ikea Smart Outlet Power Switch Zigbee Deconz  
Philips Hue Lights Light Zigbee Deconz  
Philips Hue Switch Wireless Switch Zigbee Deconz  
Philips Hue Motion Sensor Sensor Zigbee Deconz  
Tp-Link HS110 Power Switch + Monitoring Wi-Fi Tp-link + MQTT  
Energenie Whole House Power Monitor Monitoring 454mhz MQTT