emonPi as a Home Automation Hub

I believe automation can play an useful role in helping to reduce energy consumption. For example being able to control my home central heating system remotely enables me to only turn on the heating when it’s required and not have it running on a set schedule when the house is empty.

In this post I want to share with you how I use the emonPi in my own home.

Here is a video demo using Google Home to control my central heating and devices via MQTT:

Read on to learn how this is achieved using an emonPi and open-source software…

There are many many options when it comes to home automation and control. Where possible I prefer open-source solutions which do not depend on any third-party services. All the software services for my home system as I describe in this post runs locally on my emonPi and apart from Google Home voice integration does not require an internet connection to function. A self-hosted open-source solution has the added benefit of increased privacy and security which you are in fully in control of.

MQTT

MQTT lightweight communication protocol is used as the ‘glue’ communication layer between all the following services. See technical/MQTT section of the User Guide for more info about how MQTT works on the emonPi.

Energy Monitoring

Emoncms…obviously!

Recently I have been loving using the V2 Emoncms Android app (currently in beta) which supports multiple pages (see forum thread).

Video demo Emoncms Android app V2 beta:

I have also recently enjoyed using the redesigned Emoncms Apps module which have just bee released on Emoncms.org. It’s now possible to have more than one MyElectric or MySolarPV ‘app’ per Emoncms account and Economy 7 split time of use tariffs are now spported (see forum thread):

Control

Central Heating

To control my gas central heating boiler I use an MQTT WiFi relay which also has a built in thermostat and scheduler, although I don’t use these features, I just control directly via MQTT. The WiFi Relay has been very reliable, it’s been used daily for the past two years in my home and never once required a reboot.

Plug sockets (lights)

I use LightWave RF plugs to which I have lights and other entertainment devices connected e.g. stereo and chromecast. Being able to switch a whole plug bank on/off has the advantage of being able to turn devices fully off when not in use to minimise any vampire drain.

LightWave RF devices are not perfect, the OOK RF protocol is simplistic, unsecure, occasionally unreliable and state feedback is not available. I am considering swithcing to ESp8266 based Sonoff plug with third party MQTT firmware or EmonESP firmware.

Interface

For the past few years I have been using OpenHAB as the control interface. OpenHAB is pre-loaded onto the emonPi emonSD pre-built image. I am yet to upgrade to OpenHAB V2.0, it looks very nice. However, V1.8 has been very reliable and fits my needs. I use the OpenHAB Android app to access the interface quickly from my phone:

A while back (early 2016) I dabbled with HomeAssistant, (see blog post). I was quite impressed, I have been following the project and it looks like it’s matured to be an excellent home automation platform. Quit possibly a rival to OpenHAB.

Another option for an interface is NodeRED Dashboard which is now officially part of the NodeRED project.

The beauty of MQTT is that it’s platform agnostic, it’s possible to have many different interfaces controlling the same control nodes.

Voice interface

I’ve recently acquired a Google Home voice activated speaker, with a little help from ha-bridge to emulate a Philips Hue bridge it’s quite easy to get Google Home to control local devices via MQTT. The same setup will also work with Amazon Echo. See ha-bridge setup guide for emonPi

I also have a nodeRED flow that handles turning off the heating when the temperature in the livingroom (as measured by emonTH) reaches a set point. I could have used the thermostat controller on the WiFi relay to do this, however it would be difficult in my house to run the wired temperature sensor from the Wifi relay to the living room, therefore I use a wireless emonTH temperature instead.

Security and remote access

Remote control (from outside the local network) can be achieved using a dynamic DNS service such as DuckDNS or secure VPN to give access to services from the outside. E.g I open port 8080 to give access to OpenHAB running on my emonPi from the internet. OpenHAB has authentication turned on and HTTPS can be used to create a secure connection.

Alternatively, and possibly a better solution could be to use MyOpenhab.org service to allow remote control without having to open up a port externally.