7 minute read

OpenHAB is a lot of fun :) It is a platform for home automation that I use extensively in my home.

Warning: This content is outdated and will be replaced soon. Stay tuned for an updated version of this article with the latest information on home automation and smart home technologies.

This page outlines my Home Automation Infrastructure. I will hopefully add details over time with code snippets, configuration examples, etc.

OpenHAB

OpenHAB is Home Automation Software - it’s the brain of my home automation setup.

OpenHAB is what knows the state of all connected things in my home - and can make decisions about what to turn on/off or control around the house. This a far more capable system than most off-the-shelf consumer oriented commercial product - but at a cost of a learning curve when getting started.

The the power of OpenHAB - but also the source of the learning curve is probably most in the creation of OpenHAB Rules. These are a Java-like code syntax - with an event based model; where the code you write is about responding to events (such as Sun Set, People arriving/leaving home, etc). The coding approach allows for very flexible behaviours

Another big strength of a system like OpenHAB is the community and ecosystem of plugins that provide help and features to connect to a wide range of 3rd party connected devices (like Smart TVs, Heating Systems like Nest, Hive, etc).

OpenHAB is not the only high quality, open source Home Automation platform. Home Assistant is a similarly capable platform with a big community and ecosystem.

If you have to press a button or ask Alexa to do something, it’s not automatic.

A lot of my home automation is based around the theory that if you have to press a button or ask Alexa to do something, it’s not automatic. I plan to document some of my more interesting configurations over coming months on this blog.

IOT Security & Reliability

OpenHAB doesn’t use The Cloud to work. It doesn’t require an Internet connection to work properly.

I live in a rural area where broadband can sometimes be unreliable - so everything needs to work when the internet is down or slow.

In reality, the Amazon Echos, etc do create dependence on a working internet connection for optimal control of the system - but HomeKit continues to work fine as a fallback option.

There is also the question of trusting Amazon Echo/Alexa devices not to behave like a malicious spy in your home. I’m still on the fence about how serious that risk is - but have no plans to don the tinfoil hat and chuck Jeff Bezos’s listening devices into the bin yet.

Home Automation Use-Cases

  • Lighting Automation
  • TV Automation
  • Hot Water Automation
  • Solar Power Consumption Optimisation
  • Dinner Time, Bedtime Routines
  • Visitor Mode

Home Automation Controls

Systems that allow engagement between users and the home automation - input or output.

These provide a way for my family to control the home automation - but they are not the ‘brains’ of the system; they provide a user interface function only (or mostly at least!).

Amazon Echo (Alexa) devices provide the primary voice control with the home automation system - but it’s not 100% reliable. HomeKit (Siri) works fine for control too - but only from Apple Phones/iPads/Watches. Siri makes a perfect backup in our home as both my wifi and I have apple devices

I don’t have the money to afford Apple HomePods all around the house. Most the the house can be covered with Echo devices for the cost of 1-2 HomePods.

Amazon Echo

to speak instructions to the home automation while around the house. There is an Echo or an Echo Dot in most rooms of the house.

Alexa, turn on the lights

Alexa, dinner time

Apple HomeKit

similar to Alexa, but speak to Siri instead. Also works for Home app on iPhone and Apple watch - whether inside our outside the home. Very handy on series 4 Apple Watch with ‘lift to speak’ Siri.

OpenHAB’s HomeKit plugin provides the capability to bridge with HomeKit - including it’s ability to work from anywhere with an internet connection.

HomeKit also provides some presence detection - through the use of Phone Location to know who’s home and not.

Hardware

To connect the software to the real world :)

Raspberry Pi

I got started with OpenHAB using a Raspberry Pi, running openHABian distribution of OpenHAB. It’s about as Turn-Key as it gets for OpenHAB.

I also use Raspberry Pi devices to power DNS, Squid Proxy, Asterisk PBX, Bluetooth LE Presence Detection, Mosquito Server.

RFLink Listens on 433Mhz wavelength for signals from cheap radio sensors & devices, and broadcasts messages to MQTT when it receives messages over the air.

Most of the sensors I have use an RF protocol called EV 1527. RFlink makes dealing with these signals easy.

Ali Express 433Mhz Components

Security is arguably a problem with these 433mhz devices as all devices broadcast out in the open - and can be easily sniffed, spoofed or jammed. I’d be cautious about using these in security applications - but for home automation, I think they are fine.

The other thing to watch out for is too many 433Mhz sensors broadcasting too often, causing clashes with signals and an associated deterioration in reliability of receiving the sensor readings correctly. More info about this under PIR sensors in particular.

Door Sensors

I use these sensors from Ebay. They work with RFLink and send separate Open and Close messages. I have been using these for at least 6 months without needing to change batteries yet.

I have also tried the Itead door sensors - the work ok - but only send an ‘Open’ message when a door is opened. The don’t send any message when a door is closed which isn’t ideal for my purposes.

PIR Motion Sensors

I have used 2 types of PIR sensors - both cheap from Ebay/AliExpress/Bang good.

  • Itead PIR2 Sensors (Bang good)
    These use 2xAA batteries and have switches that allow you to configure power saving settings.
    The ones I have set up with power savings settings are still working fine after 6 months with quality AA batteries.
  • Fuers PIR Sensors (Ali Express)
    Uses 9V batteries and seem to last a couple of months between battery changes.
    I have stopped using these as my preferred PIR sensors as they don’t have the ability to only broadcast motion every few minutes - instead of constantly broadcasting while detecting movement. This shortens battery life in an area with a lot of motion - and creates unnecessary 433Mhz noise, reducing overall reliability for 433Mhz devices.
    These cost less than the Itead sensors - but they will cost a lot more over time with more frequent battery replacement.

Environment Sensors

I mostly use DANIU 433MHz Wireless Weather Sensors from Ali Express. They take 2xAAA batteries and seem to last more than 6 months. They can be mounted on a wall, or placed on a flat surface and have a display that shows current temperature and humidity.

They broadcast a signal every minute with the current sensor readings - and can have a switch to choose between 3 channels.

If you have more than 3 of these, these sensors will mostly work fine - but there’ll be times when they broadcast clashing signals, resulting mostly in occasional gaps in data arriving at the home automation system from the sensors. They are not smart enough to ensure delivery of their readings by re-broadcasting, etc. WIFI sensors would solve for this - but they cost multiples of the cost of simple sensors.

Environment Sensors have been useful in our home, by identifying that some rooms on our house had higher humidity than ideal. Sensor data is graphed in Grafana, allowing us to track moisture levels and measure the effectiveness of the measure we took to control moisture.

I also have some environment sensors based on a Wemos D1 Mini + DHT22 sensor. These are a LOT more work than simple radio sensors - but can be configured with all types of sensors.

Sonoff WIFI Relay + Tasmota Firmware

Itead Produce a range of WIFI Switch for turning devices & lamps on and off.

best used in a water proof box with securing cable glands - the screw-down terminals for the wires are not secure enough to survive somebody tripping over the wire.

Some Sonoff switches have a CE certification and some don’t - buyer beware!

InfluxDB + Grafana

The combination of InfluxDB and Grafana allows the long term logging of data from OpenHAB and Graphing this over time in Grafana. This is very useful for creating dashboards and graphs of environmental conditions, and providing status of the system. It also works ‘inside the firewall’ so doesn’t require a cloud service to operate.

I run InfluxDB and Grafana as Docker Containers on an Unraid NAS/Server. This greatly simplifies the deployment of the software with its dependencies, etc.

Future Plans

This page gives a very high level introduction to my Home Automation setup. I hope to deep dive into some of the details and more interesting parts over coming months.