Open energy monitor home Automation Hub with MQTT, nodeRED, OpenHAB & LightwaveRF
At the fully Charged live event at Silverstone earlier this month we stopped by the open energy monitor mean a chat with Glyn Hudson (check out the NIEVO video below for a taste of the show).
Glyn’s smart home configuration is based around the emonPi and employs MQTT, nodeRED, OpenHAB, LightwaveRF and Google Home.
Over to Glyn for all the good stuff…
I believe automation can play an useful role in assisting 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.
As previously mentioned in a blog post, the emonPi (running emonSD pre-built SD card) can function as a powerful home automation hub. Utilising the emonPi as a home automation hub is a good fit for a number of reasons:
It’s already running 24/7 for energy monitoring
It’s optimised for robust long term operation: the root Raspberry Pi file-system is read-only to increase SD card lifespan
It’s already connected to your local network
It’s running Debian Raspbian Jessie therefore installing extra bundles is easy and lots of support is available
Raspberry Pi 3 has plenty of space capacity
Extra radios / accessories can be connected via USB
It’s already running an MQTT server
emonSD pre-built SD card comes pre packed with the following integrations nodeRED, OpenHAB and LightWaveRF
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 gadgets 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 supported (see forum thread):
Control
Central Heating
To control my gas central heating boiler I use an MQTT WiFi relay which also has a developed 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 gadgets connected e.g. stereo and chromecast. being able to switch a whole plug bank on/off has the advantage of being able to turn gadgets fully off when not in use to minimise any vampire drain.
The emonPi can control LightWave RF gadgets directly via MQTT if an RF OOk modules is fitted. See LightWave RF emonPi user Guide.
LightWave RF gadgets 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 reputable and fits my needs. I use the OpenHAB Android app to access the interface quickly from my phone:
OpenHAB also integrates with my Pebble smartwatch which makes it super easy to turn on/off the heating while out and about:
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 recentlyacquired a Google home voice triggered 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 gadgets via MQTT. The same configuration will also work with Amazon Echo. See ha-bridge configuration guide for emonPi.
See video demo at the top of this post.
Device config using ha-bridge webpage GUI:
Google home app setup:
Integration & Automation
I use NodeRED which is pre-loaded on emonPi / emonSD to integrate with other services such a getting the latest outdoor temperature from weather Underground, send push notifications (heating on / off temperature alert) to my phone using Pushover. Both these services have pre-made nodeRED flows making integration very easy. NodeRED is pre-installed and configured on emonPi / emonSD. The example flow included on emonPi demonstrates reading emonTH data from MQTT and external temperature data from weather Underground.
I also have a nodeRED flow that handles turning off the heating when the temperature in the livingroom (as determined 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.
Home assistant has got an example of using Tor Onion services to access home assistant running locally.
Visit openenergymonitor.org
Reproduced from the original blog post by kind permission of Glyn Hudson.
Share this:
Facebook
Twitter
Reddit
LinkedIn
Pinterest
Email
More
WhatsApp
Print
Skype
Tumblr
Telegram
Pocket