The Quantified Home

Featured image

Some weeks ago I was fiddling with Docker and found a premade Graphite image in the Docker repo. Anyone that has tried to install Graphite knows it is not a very straight forward process, so I got excited and the image turned out to just work. Now I wanted to push some data into my Graphite instance. So I started with Node and looked for a way to fetch data from my sensors on Telldus Live. A few nights later I had started two new repos on github: telldus2graphite and telldus-live-promise. Sensor data from Telldus Live can be fetched by calling the telldus2graphite Node script from a cron job:

* * * * * node <path to telldus2graphite>/node_modules/.bin/telldus2graphite

I thought it could be useful to extract the Telldus Live part from the telldus2graphite project to its own project. I had started out using the telldus-live npm module in the beginning, but I wanted to roll my own based on promises, hence the name telldus-live-promise. Instead of using callbacks the syntax goes like this:


Our electricity meter is hooked up to an ELIQ energy monitor. Although ELIQ has a rather attractive and powerful visual interface, I wanted to fetch energy data into Graphite as well. So I made two more repos: eliq2graphite and eliq-promise.

Fetching the last 24 hours of energy data every hour with eliq2graphite would look like this:

0 * * * * node <path to eliq2graphite>/node_modules/.bin/eliq2graphite --age 24 --resolution hour

eliq2graphite is using eliq-promise to access the ELIQ API, and the syntax goes like this:

eliq.getFromTo (<startdate>, <enddate>, '6min' | 'hour' | 'day').then(console.log).catch(console.log);
{ startdate: '2015-03-02T20:00:00+00:00', 
  enddate: '2015-03-02T23:00:00+00:00',
  intervaltype: '6min',
    [ { avgpower: 2790,
    energy: 279,
    temp_out: null,
    time_start: '2015-03-02T20:00:00',
    time_end: '2015-03-02T20:06:00' },

With both sensor values and energy consumption in Graphite I wanted to create a more visual appealing dashboard than the built in ones that Graphite provides. I made a fork of Graphene and created my dashboard there. Creating dashboards in Graphene is very straight forward and I decided to serve it as simple as possible using python SimpleHTTPServer running as a screen process:


cd graphene

lineCount=`screen -r graphene | grep &quot;There is no screen to be resumed matching graphene.&quot; | wc -l`

if [ $lineCount -eq 1 ] ; then
    echo linecount: $lineCount. Starting in a deteched screen named graphener. Use screen -r graphene to view.
    screen -dmS graphene python -m SimpleHTTPServer 8888
    echo lineCount: $lineCount. graphene is already running. Use screen -r graphene to view. Running now.
    screen -r graphene

I’m using an old netbook to run Graphite, Graphene, and the cron jobs. By the way, old netbooks are great for home servers – they come with UPS and monitors, take up minimum space and are quiet and energy efficient. The dashboard is displayed on an v.1 ipad in the kitchen (it can still do that job). Well, that’s it.