Sunday 21 August 2016

Energy measurement with Domoticz and Grafana. Yes, it's easy!

A while ago I started tracking the power and gas consumption at home. To do this I read the meters every sunday afternoon and this gave me some insight in the power consumption. Unfortunately this also means that you have the measurement resolution of a week, so you can't really change your habits and see the effect on power/gas consumption.


Because I've already set my thermostat to it's most eco-friendly settings (water pump set to slowest, comfort mode off and a reasonably low temperature) and it's summer now anyway I decided to focus on power. In the Netherlands you can purchase a rebranded NorthQ NQ-92021 Z-Wave power monitoring device, which is called the Eminent EM6600 Energy Reader Set. The set consists of a Z-Wave box with a connector for a sensor that you stick on your power meter and a USB Z-Wave transceiver. To be honest at this price point it's an absolute steal compared to most Z-Wave hardware. It works on meters with an LED as well as meters with a spinning disc.

While the hardware is awesome considering its price tag the software is built in Adobe Air and is only released for Windows. While it is possible to do setup without the software I decided the easier route would be to just start a VM with Windows and do the setup, pairing and calibration with the provided software.

List of my hardware in Domoticz:
the OpenZWave device is at the top
of the list.
After pairing the EM6600 meter and installing it (see the software application for this, every step is explained) you can remove the USB stick from your PC and attach it to your Pi. In Domoticz go to Setup > Hardware and add a device of type OpenZWave USB. You can see what the entry should look like
here (it's at the top of the list).

When you open the Setup for the OpenZWave USB you should already see the EnergyMeter device in the list. Note that every change you make to the EnergyMeter will take up to 15 minutes to process and apparently operations are queued. By sending a lot of commands I delayed receiving data. So just be patient and wait for data! If it doesn't work after waiting for 30 minutes or so, fiddle around, but keep the number of changes to a minimum to prevent even more delay.

So you've got data. Now what?

After fiddling with Domoticz to see some actual data I decided I wanted more. The resolution of the data displayed within Domoticz is low (1h when viewing data per day) but I have been writing incoming data to InfluxDB for some time now. I wanted Grafana on my Pi! I had a look on the interwebs only to find that apparently the Raspberry Pi B is not supported by most of the arm/pi guides for installing Grafana. I decided to go with this guide, but with a few changes to work with the Raspberry Pi B. You can download the resulting binary here (which is built from v4.0.0-pre1 (commit: v3.1.0+226-g3077f99-dirty)) and if anyone asks I'll do a short writeup on how to do this yourself. Please leave comment if you're interested! It involves installing node binaries, ruby and go. Most of these won't install 'the easy way' because the Pi B/B+/Compute Module/Zero don't feature the instruction set their newer brethren do.

To install my build from the Grafana master branch

wget https://dl.dropboxusercontent.com/u/3261971/grafana-pi-armv5/grafana-4.0.0-pre1.g3077f99.deb?dl=1
sudo apt-get update && sudo apt-get install linfontconfig1:armhf fontconfig-config -y
sudo dpkg -i grafana-4.0.0-pre1.g3077f99.deb

After running the above, you should be able to get started using Grafana on your Raspberry Pi Compute Module, Model A/B/B+ and Zero!

Power consumption graph
in Domoticz
Power consumption graph and indoor/outdoor temperature graph in Grafana
You can see that the power consumption has more fluctuations at night time
than the graphs from Domticz.

2 comments:

  1. Hello.
    I am interested in the binaries as I would like to use my RPiB+. Unfortunately the link seems broken..

    Would be glad if you could help.

    Thanks ans best regards

    ReplyDelete
    Replies
    1. Found binaries for all RPi versions here:
      https://github.com/fg2it/grafana-on-raspberry/

      Delete