More than one consolidationfunction for rrd4j in OH2 supported?


after having some pain with the stable branch I played (due to bad weather…) with the actual OH2.2 dev one. At least it is running now for last few hours and also RRD4j is working like it should with HomeMatic devices.
As I copied the config from OH2 stable, I now noticed also one major constraint:

# please note that currently the first archive in each RRD defines the consolidation
# function (e.g. AVERAGE) used by OpenHAB, thus only one consolidation function is
# fully supported

As I wanted to plot mainly temperature curves, I intended to have a rrd4j definition for the archive as below


This would give me the avearge, but I would like to get also the min and max values from the past.

  • Is the comment just from historical reason inside?
  • How could I get hold of the average, min and max values?
  • And how could I display the average, min and max values at same time in one diagramm?

Due to fancy graphics and acceptance from my wife I still want to use CometVisu with just support for rrd4j, hence I’m sticked to it and couldn’t switch to e.g. grafana with Influx (and own rules).

  • Are you aware of extensions for CometVisu to support more than just rrd4j?

Thanks again, Robert

I question the use of different consolidation functions in one rrd4j database!
I normal setup of the archives in a rrd4j database is like this:
The first archive is taking a value every minute ( a consolidation function isn’t needed for this one value). The number of samples held in this archives can be set.
Each following archives creates a consolidated value out several values (step) of the archive before using the consolidation function set. The number of values in this archive can also be set.
Whenever you try the get data from the database, it will be taken completely from the archive that covers the requested timeframe.
If you want to have readouts from different consolidation functions you need to create different databases for them.

Please take a look at the demo configuration
As you can see, there are 3 values in the graph. This is done through grouping. You have to define three items and update minimum and maximum value through a rule.


many thanks for shedding some light on this one. Missunderstood rrd4j nearly completley as I thougt rrd4j takes care of having enough values for filling the archive as desired, e.g. max and min. In my configuration I assumed rrd4j takes the last 24h every minute and afterwards stored the max (and min) value by the last two functions. I was not aware of the fact, rrd4j is calculating them one after the other. I thought they are equal/at same time handled and start therefore with same “initial” step size of 1min.
For my example this would mean:

  • every 5min the average (of the last 5 values due to fixed step size of 60sec) is stored (8928 in total) => 31d = 1 month
  • I now assumed the second one would store every 30min the average. But according to your explanation it’s not assigned to the initial step size of 60sec, but in fact to the one of the archive before (5min) ==> so the second one would calculate every 30 * (5 * 60sec (from first one)) = 150 min = 2,5h an average value and would store in total 8784 values
  • third average is working same and also the mina nd max ones…

That was not my intention at all…
So in my case for the min and max values I should first store for 24h all values every minute and afterwards have the given min/max archive applied…
Would this one work:

tempinside5min.archives=AVERAGE,0.5,5,8928 // average values calculated from 5min for total length of one month
tempinside30min.archives=AVERAGE,0.5,30,8784 // average from 30min
tempinside60min.archives=AVERAGE,0.5,60,17520 // average from every hour
tempinsidemin.archives=MIN,0.5,1440,1825 // min temp from one day/24h
tempinsidemax.archives=MAX,0.5,1440,1825 // max temp from one day/24h

Or some could be put in one line:


first one stores average every 5min, second every 6 * 5min = 30min and last one every 2 * 6 * 5min = 1h.

For integrating graphs the linked demo is in my opinion some not so clever choice. Indeed it showed how to get several plots in one diagramm. But the content is some kind of very confusing… How could a “todays min/max” change within 24h for several times if you have a look on the day and week plots?

I put some efforts to start the rrd4j at midnight to get out of this as the normal rrd paraemters for the definition of a starting point seem to be not working…

For other readers: getting influx and graphana working in CometVisu is quite easy, but “breaks” somehow the concept as graphana could be only included as (i)Frame givng complete control to graphana. However: it’s working fine.

Thanks again for your help and showing me the correct implementation

Maybe I wasn’t clear enough. The first archive needs to take a value every minute in order to have the values for the following to draw from. In your case, if you are only interested in the 5 minute averages the first archive only needs to keep 5 values, but they need to be there ( at least if I understand it correctly).
In the next archive you can store the 5 minute step averages.
Each following archive is calculated by the previous one, so the covered time needs to be a multiple of the preceeding one.
The number of values held in a specific archive depends on two things. First on the step-size of the following archive ( if you want to calculate the average/max/min from X values, the preceeding archive needs to have at least X values).
Secondlay the number of values you want/need to use in that archive ( for example I want to have the data for each minute for the last 24 houres, beyond that I want to have values every 15 minutes for a week and further every hour for 4 weeks).
I hope it is clearer now.