Round Robin Database

From time to time, the HR80 radiator controller send the temperature they measure with an internal sensor. I wanted to display this data in a chart, and used RRDTool, which I already knew from previous (software) projects of mine.

Let’s quote wikipedia:

RRDtool (acronym for round-robin database tool) aims to handle time-series data like networkbandwidthtemperatures,CPU load, etc. The data are stored in a round-robindatabase (circular buffer), thus the system storage footprint remains constant over time.

It also includes tools to extract RRD data in a graphical format, for which it was originally intended.

Bindings exist for PerlPythonRubyTclPHP and Lua.

Okay, as I have six of this HR80 radiator controllers in my house, I created a round robin database for these using RRDTool:

rrdtool create temperature.rrd --step 300 \
DS:DG_WOHNEN:GAUGE:600:10:50 \
DS:DG_BAD:GAUGE:600:10:50 \
DS:EG_WOHNEN_1:GAUGE:600:10:50 \
DS:EG_WOHNEN_2:GAUGE:600:10:50 \
DS:EG_WOHNEN_3:GAUGE:600:10:50 \
DS:OG_BAD:GAUGE:600:10:50 \
RRA:AVERAGE:0.5:1:1200 \
RRA:MIN:0.5:4:2400 \
RRA:MAX:0.5:4:2400 \

This creates the six RRD data sources, step width are 5 minutes (300 seconds). The python script receiving and decoding the HR80’s messages just writes the temperature value received to this RRD:

# Update RRD
if deviceId1 in controller:
'--template', controller[deviceId1],
'N:' + str(temperature))

Creating a chart of this round robin database is a piece of cake. I use the following RRDTool command:

#!/usr/bin/env python

import rrdtool

ret = rrdtool.graph( “./temperature.png”, “–start”, “-1d”, “–vertical-label=Temperatur”,
“-w 800”,
“-h 400”,
“LINE2:m1#0000FF:DG Wohnen\\r”,
“LINE2:m2#00FF00:DG Bad\\r”,
“LINE2:m3#00FFFF:EG Wohnen 1\\r”,
“LINE2:m4#FF0000:EG Wohnen 2\\r”,
“LINE2:m5#FF00FF:EG Wohnen 3\\r”,
“LINE2:m6#FFFF00:OG Bad\\r”,
“GPRINT:m1:AVERAGE:Avg m1\: %6.0lf “,
“GPRINT:m2:AVERAGE:Avg m2\: %6.0lf “,
“GPRINT:m3:AVERAGE:Avg m3\: %6.0lf “,
“GPRINT:m4:AVERAGE:Avg m4\: %6.0lf “,
“GPRINT:m5:AVERAGE:Avg m5\: %6.0lf “,
“GPRINT:m6:AVERAGE:Avg m6\: %6.0lf “,

print ret

An example chart created by this command:
This shows a time series of temperature measurements of all my six HR80 radiator controllers. You can see the temperature going down at 22:00 from 21° celsius to 17° celsius at 8:00 in the morning, where it again goes up in direction of 21° celsius.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s